您的位置:首页 > 数据库 > Oracle

Oracle oradebug中止、挂起LGWR进程(Suspend LGWR Process)

2017-06-01 15:58 519 查看
Oracle Core: Essential Internals for DBAs and Developers 书中有一段关于挂起LGWR进程的描述,实验如下:

--获取LGWR的pid

--10g以前
select
prc.pid,
bgp.name
from
v$bgprocess bgp,
v$process prc
where
bgp.name = 'LGWR'
and prc.addr = bgp.paddr;

--10g及以后
select prc.pid, prc.pname from v$process prc where prc.pname = 'LGWR';

--返回的pid为11,以下操作按时间顺序

--session1 中止lgwr进程
SQL> oradebug setorapid 11
Oracle pid: 11, Unix process pid: 2401, image: oracle@sean.ora11g (LGWR)
SQL> oradebug suspend
Statement processed.

--session2
SQL> insert into t values(1);
1 row created.

SQL> commit;
hang住

--session1
SQL> oradebug resume
Statement processed.

--session2
Commit complete.


总结:用户commit成功的前提条件是事务相关的log buffer都已经写入到磁盘online redo log中。将LGWR进程挂起,导致无法写log buffer,自然也就无法提交成功。

附:

LGWR进程从log buffer往online redo log写日志的5个场景:

用户提交事务;

在线日志发生切换;

每3秒;

redo log buffer 1/3满,或者缓存数据达到1m;

DBWn进程必须要写data buffer到磁盘。(在DBWn写data buffer到磁盘之前,与这些buffer修改相关的redo log必须先写到磁盘,write-ahead协议)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息