今天是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;

查看热点块对象:


SELECT E.OWNER, E.SEGMENT_NAME, E.SEGMENT_TYPE
  FROM DBA_EXTENTS E,
       (SELECT *
          FROM (SELECT ADDR, TS#, FILE#, DBARFIL, DBABLK, TCH
                  FROM X$BH
                 ORDER BY TCH DESC)
         WHERE ROWNUM < 11) B
 WHERE E.RELATIVE_FNO = B.DBARFIL
   AND E.BLOCK_ID <= B.DBABLK
   AND E.BLOCK_ID + E.BLOCKS > B.DBABLK;
找到sql之后需要做的就是查看执行计划,判断问题所在,并进行优化。
1、对于在shared pool存在的cursor可以通过如下命令查看执行计划
select * from table(dbms_xplan.display_cursor('sql_id',null,'allstats'));
2、对于历史可以通过查看awr信息获得:
select * from table(dbms_xplan.display_awr('sql_id'));
另外对于设备引起的需要查看磁盘读写信息,可以 通过vmstat 2 200进行判断。

Reducing Number of Waits:

  1. If you are seeing long delays taken to service this wait event then check the amount of I/O being performed on the device identified by the P1 argument of this wait event.
    The device and / or the controller may be overloaded. If this is the case then take the standard steps of spreading the file across further devices etc.
  2. Check that the real problem isn't the amount of time that the operating system is taking to service the system call.
  3. Find out which file numbers are causing the highest average waits and then determine which filesystem contains the file
  4. Determine why the filesystems are performing poorly. Some common causes are:
    • "hot filesystems" - too many active files on the same filesystem exhausting the I/O bandwidth
    • hardware problem
    • In Parallel Execution (PX) is being used, determine if the I/O subsystem is saturated by having too many slaves in use.
参考文档:
文档 ID 1477229.1
 
 
——————————————————————————————————————————————————————————————————————————————————————————————————Rhys——————————————
 

read by other session 等待事件。的更多相关文章

  1. ORACLE等待事件:read by other session

    read by other session简介 官方关于read by other session的介绍如下: When information is requested from the datab ...

  2. 【Oracle】等待事件之 V$SESSION_WAIT

    (1)-V$SESSION_WAIT 这是一个寻找性能瓶颈的关键视图.它提供了任何情况下session在数据库中当前正在等待什么(如果session当前什么也没在做,则显示它最后的等待事件).当系统存 ...

  3. 一个session已经ACTIVE20多小时,等待事件SQL*Net more data from client

    问题描述: 一个session已经ACTIVE20多小时,等待事件SQL*Net more data from client 有一人session,从昨天上午11点多登陆(v$session.logi ...

  4. 查看历史会话等待事件对应的session信息

    此处以enq: TX - row lock contention等待时间为例. 查看snap_id对应时间 select to_char(s.startup_time,'dd Mon "at ...

  5. 数据库服务器CPU持续百分之百、部分Session一直处于执行状态---等待事件为:asynch descriptor resize(Oracle Bug )

    问题描述: 项目反馈数据库服务器的CPU持续100%的情况,跟踪发现很多活动会话的等待事件是“asynch descriptor resize”,并且这些会话一直处于Active状态,而这些会话执行的 ...

  6. Oracle Tuning 基础概述01 - Oracle 常见等待事件

    对Oracle数据库整体性能的优化,首先要关注的是在有性能问题时数据库排名前几位等待事件是哪些.Oracle等待事件众多,随着版本的升级,数量还在不断增加,可以通过v$event_name查到当前数据 ...

  7. SQL SERVER中的OLEDB等待事件

    OLEDB等待事件介绍 OLEDB等待类型是SQL SERVER 数据库中最常见的几种等待类型之一.它意味着某个会话(SPID)通过SQL Server Native Client OLEDB Pro ...

  8. ORACLE等待事件:enq: TX - row lock contention

    enq: TX - row lock contention等待事件,这个是数据库里面一个比较常见的等待事件.enq是enqueue的缩写,它是一种保护共享资源的锁定机制,一个排队机制,先进先出(FIF ...

  9. ORACLE等待事件: log file parallel write

    log file parallel write概念介绍 log file parallel write 事件是LGWR进程专属的等待事件,发生在LGWR将日志缓冲区(log_buffer)中的重做日志 ...

随机推荐

  1. 高校区LAN局域网校内网组建实践经验

    项目描述: ●校区计算机网络组建与管理和维护. 主要内容: 1.电脑故障诊断与排除与维护. 2.修复局域网内的故障电脑. 3.局域网架设虚拟系统. 4.局域网升级. 5.局域网基础架构. 6.电脑系统 ...

  2. (转)android媒体--stagefright概述【一】

    转自:http://blog.csdn.net/loovejava/article/details/8971790 最近杂七杂八的忙碌着,前几天看了下这部分主要是stagefright模块的,所以更改 ...

  3. (源)VC助手VA破解使用指南

    一般情况下,你下载的破解版的VC助手,要么自带的有一个名为VA_X.dll的文件,要么是有一个可运行的破解程序,根据不同的情况进行如下操作,只要你下载的安装文件没有问题,就能正确打上破解补丁.网上有一 ...

  4. 图解DHCP的4步租约过程

    图解DHCP的4步租约过程   DHCP租约过程就是DHCP客户机动态获取IP地址的过程. DHCP租约过程分为4步: ①客户机请求IP(客户机发DHCPDISCOVER广播包): ②server响应 ...

  5. HTML5重力感应小球冲撞动画实现教程

    今天我们来分享一款很酷的HTML5重力感应动画教程,这款动画可以让你甩动页面中的小球,小球的大小都不同,并且鼠标点击空白区域时又可以生成一定数量的小球.当我们甩动小球时,各个小球之间就会发生互相碰撞的 ...

  6. JNDI 在 J2EE 中的角色

    JNDI 在 J2EE 中的角色 Spring整合HIbernate时,三种数据库连接池的配置和比较 Tomcat 6 JNDI数据源详解 Tomcat 6 --- JNDI详解 Spring整合HI ...

  7. 微信小程序/支付宝小程序 WxParse解析富文本(html)代码

    小程序本身并不太支持html代码,比如html的img.span.p这个时候改这么办呢?需要用到一个小插件WxParse来实现. 小程序高级交流群:336925436  微信小程序支持富文本编辑器代码 ...

  8. 使用 resizableImageWithCapInsets 方法实现可伸缩图片

    之前介绍过通过 stretchableImageWithLeftCapWidth:topCapHeight: 方法来实现可伸缩图片: 可看这篇随笔:使用 stretchableImageWithLef ...

  9. 为npm设置代理

    npm全称为Node Packaged Modules.它是一个用于管理基于node.js编写的package的命令行工具.其本身就是基于node.js写的,这有点像gem与ruby的关系. 在我们的 ...

  10. MSM--Memcached_Session_Manager介绍及使用

    MSM--Memcached_Session_Manager介绍及使用 http://www.iteye.com/topic/1125301 我们都知道对于一些大型的web2.0的网站,在正式部署时一 ...