查询v$session_wait,可以看到等待事件

V$SESSION_WAIT中的常用列:
SID: session
标识
EVENT: session
当前等待的事件,或者最后一次等待事件。
WAIT_TIME: session
等待事件的时间(单位,百分之一秒)如果本列为0,说明session当前session还未有任何等待。
SEQ#: session
等待事件将触发其值自增长
P1, P2, P3:
等待事件中等待的详细资料
P1TEXT, P2TEXT, P3TEXT:
解释说明p1,p2,p3事件
附注:
1.State
字段有四种含义﹕
Waiting
SESSION正等待这个事件。
Waited unknown time
:由于设置了timed_statistics值为false,导致不能得到时间信息。表示发生了等待,但时间很短。
Wait short time
:表示发生了等待,但由于时间非常短不超过一个时间单位,所以没有记录。
Waited knnow time
:如果session等待然后得到了所需资源,那么将从waiting进入本状态。
Wait_time
值也有四种含义:
>0:最后一次等待时间(单位:10ms),当前未在等待状态。
=0session正在等待当前的事件。
=-1:最后一次等待时间小于1个统计单位,当前未在等待状态。
=-2:时间统计状态未置为可用,当前未在等待状态。
3.Wait_time
Second_in_wait字段值与state相关:
如果state值为Waiting,那么wait_time值无用。Second_in_wait值是实际的等待时间(单位:秒)
如果state值为Wait unknow time,那么wait_time值和Second_in_wait值都无用。
如果state值为Wait short time,那么wait_time值和Second_in_wait值都无用。
如果state值为Waiting known time,那么wait_time值就是实际等待时间(单位:秒)Second_in_wait值无用。

 

查询等待事件

select * from v$session_wait where event not in ('rdbms ipc message','SQL*Net message from client')

如果是latch free的话,再通过P2的值查询v$latch视图

select * from v$latch where latch#='66'  66就是上面这句中的p2

遇到的latch free等待事件

Redo allocation latch: Log Buffer中分配内存空间时需要获取Redo allocation latch
Oracle9.2之前,Redo allocation latch 是唯一的,因此向Log Buffer Cache中写入redo entries时是串行的。在Oracle9.2企业版中,Redo allocation latch 的数量由LOG_PARALLELISM控制。select name,latch#,child#,gets,misses from v$latch_children where name = 'redo allocation';

Redo allocation latch Log Buffer中为每个事务分配空间,如果事务很小或者服务器只有一个CPURedo allocation latch 同时COPY事务数据到Log Buffer Cache。在Log Switch释放空间时,Redo allocation latch Redo Copy Latch同时被释放,也即在Log Switch过程中,Redo的生成是被禁止的。
Oracle10g中,为了减少竞争,Oracle缺省的预分配19redo allocation Latch.

cache buffers chains latch:

原理上来说,buffer cacheblockheader是被放置到hash chains上,而hash chains又是放在hash bucket中,多个hash bucket被一个cache buffers chains latch保护。当多个session并发访问同一个数据块上的数据,每个session都要首先获得cache buffers chains latch,这样将造成cache buffers chains latch的争用。

通过v$latch_children可以知道每个row cache被哪一个Latch所守护

select addr,latch#,child#,level#,name,gets from v$latch_children where name='row cache objects' and gets<>0 order by gets;

 

 

 

posted on 2010-11-30 14:39  Alex.Zhang  阅读(250)  评论(0编辑  收藏  举报