您的位置:首页 > 其它

read by other session 等待事件。

2014-01-07 00:16 411 查看
   今天是2014-01-06,从今天开始,打算春节之前每天学习一个等待事件,今天就记录一下read by other session这个等待事件笔记。

什么是read by other session?

This wait event occurs when we are trying to access a buffer in the buffer cache but we find that the buffer is currently being read from disk by another user so we need to wait for that to complete before we can access it.  In previous versions, this wait
was classified under the "buffer busy waits" event. However, in Oracle 10.1 and higher, the wait time is now broken out into the "read by other session" wait event.

Excessive waits for this event are typically due to several processes repeatedly reading the same blocks, e.g. many sessions scanning the same index or performing full table scans on the same table. Tuning this issue is a matter of finding and eliminating
this contention.

参考文档:文档 ID 732891.1

 

官方介绍:

read by other session

This event occurs when a session requests a buffer that is currently being read into the buffer cache by another session. Prior to release 10.1, waits for this event were grouped with the other reasons for waiting for buffers under the 'buffer busy wait'
event

Wait Time: Time waited for the buffer to be read by the other session (in microseconds)

Parameter Description

file# See "file#"

block# See "block#"

class# See "class"

 注意有p1,p2,p3,。

当出现该问题如何解决?

一般出现该问题是由于sql导致的,或者是由于磁盘设备可能导致。

当出现该问题的时候,首先需要定位sql。

方法一:通过ash获得细粒度的报告,查看top sql statement 获得sql。

方法二:通过sql语句直接获得:

1、当前正在发生的问题:

select sql_fulltext from v$sql a,v$session b where a.sql_id=b.sql_id and b.event='read by other session';

2、历史曾经发生的

select a.sql_id,sql_fulltext from v$sql a,dba_hist_active_sess_history b where a.sql_id=b.sql_id and b.event='read by other session';

往往read by other session伴随着db file sequential read事件的出现。

另外可以查看涉及对象信息,此处就是p1,p2,p3

SELECT p1 "file#", p2 "block#", p3 "class#"

FROM v$session_wait WHERE event = 'read by other session';

通过p1,p2,p3获得热点对象:

SELECT relative_fno, owner, segment_name, segment_type FROM dba_extents

WHERE file_id = &file

AND &block BETWEEN block_id AND block_id + blocks - 1;

另外,也可以 直接查看热点块的信息,如查看热点块导致的sql语句:

select sql_text

  from v$sqltext a,

       (select distinct a.owner, a.segment_name, a.segment_type

          from dba_extents a,

               (select dbarfil, dbablk

                  from (select dbarfil, dbablk from x$bh order by tch desc)

                 where rownum < 11) b

         where a.RELATIVE_FNO = b.dbarfil

           and a.BLOCK_ID <= b.dbablk

           and a.block_id + a.blocks > b.dbablk) b

 where a.sql_text like '%' || b.segment_name || '%'

   and b.segment_type = 'TABLE'

 order by a.hash_value, a.address, a.piece;

查看热点块对象:


Reducing Number of Waits:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: