`

Read By Other Session

阅读更多

Read By Other Session

Definition: When information is requested from the database, Oracle will first read the data from disk into the database buffer cache. If two or more sessions request the same information, the first session will read the data into the buffer cache while other sessions wait. In previous versions this wait was classified under the "buffer busy waits" event. However, in Oracle 10.1 and higher this 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.

Finding the contention

When a session is waiting on this event, an entry will be seen in the v$session_wait system view giving more information on the blocks being waited for:

     
 

SELECT p1 "file#", p2 "block#", p3 "class#"
FROM v$session_wait
WHERE event = 'read by other session';

 
     

If information collected from the above query repeatedly shows that the same block, (or range of blocks), is experiencing waits, this indicates a "hot" block or object. The following query will give the name and type of the object:

     
 

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;

 
     

Eliminating contention

Depending on the database environment and specific performance situation the following variety of methods can be used to eliminate contention:

  1. Tune inefficient queries - This is one of those events you need to "catch in the act" through the v$session_wait view as prescribed above. Then, since this is a disk operating system issue, take the associated system process identifier (c.spid) and see what information we can obtain from the operating system.

  2. Redistribute data from the hot blocks –deleting and reinserting the hot rows will often move them to a new data block. This will help decrease contention for the hot block and increase performance. More information about the data residing within the hot blocks can be retrieved with queries similar to the following:

         
     

    SELECT data_object_id
    FROM dba_objects
    WHERE owner='&owner' AND object_name='&object';

    SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,0) start_rowid
    FROM dual;
    --rowid for the first row in the block

    SELECT dbms_rowid.rowid_create(1,<data_object_id>,<relative_fno>,<block>,500) end_rowid
    FROM dual; 
    --rowid for the 500th row in the block

    SELECT <column_list>
    FROM <owner>.<segment_name>
    WHERE rowid BETWEEN <start_rowid> AND <end_rowid>

     
         
  3. Adjust PCTFREE and PCTUSED – adjusting the PCTFREE value downward for an object will reduce the number of rows physically stored in a block. Adjusting the PCTUSED value for an object keeps that object from getting prematurely put back on the freelist.

    Depending on the type of contention, adjusting these values could help distribute data among more blocks and reduce the hot block problem. Be careful to optimize these parameters so blocks do move in and out of the freelist too frequently.

  4. Reduce the Block Size – this is very similar to adjusting the PCTFREE and PCTUSED parameters in that the goal is to reduce the amount of data stored within one block. In Oracle 9i and higher this can be achieved by storing the hot object in a tablespace with a smaller block size. In databases prior to Oracle 9i the entire database must be rebuilt with a smaller block size.

  5. Optimize indexes – a low cardinality index has a relatively small number of unique values, e.g. a column containing state data with only 50 values. Similar to inefficient queries, the use of a low cardinality index could cause excessive number of blocks to be read into the buffer cache and cause premature aging out of "good" blocks.

Conclusion

When a session waits on the "read by other session" event, it indicates a wait for another session to read the data from disk into the Oracle buffer cache. If this happens too often the performance of the query or the entire database can suffer. Typically this is caused by contention for "hot" blocks or objects so it is imperative to find out which data is being contended for. Once that is known this document lists several alternative methods for solving the issue.

分享到:
评论

相关推荐

    sql学习 新疆前台工单操作缓慢问题跟踪.doc

    通过数据库环境介绍、问题分析过程、AWR 报表分析和 ASH 报表分析,最终定位到问题的根源是 read by other session 的等待事件,并找到导致问题的两个 SQL 语句。 知识点一:数据库环境介绍 * 数据库环境:RAC ...

    Oracle数据库教程——oracle常见的等待事件说明[参照].pdf

    在新版本中,针对第二个场景(读取由其他会话读取中的数据块)已独立为“read by other session”。Buffer Busy Waits通常与热点块(Hot Blocks)相关,即多个用户频繁访问相同的数据块。如果等待时间过长,它会在...

    ora分析脚本

    events that someone is read by other session - ash [duration] [-f ] active session history for specified period e.g. 'ash 30' to display from [now - 30min] to [now] e.g. 'ash 30 10 -f foo.txt' ...

    Serv-U Keygen

    FTP Serv-U offers the following: ... * Log file can be read by other applications while open, or transferred through FTP Serv-U. * It is dirt cheap, only around 0.1ct per line of code!

    Java邮件开发Fundamentals of the JavaMail API

    Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click any of the topics below to link ...

    php.ini-development

    An empty string can be denoted by simply not writing anything after the equal ; sign, or by using the None keyword: ; foo = ; sets foo to an empty string ; foo = None ; sets foo to an empty string ;...

    微软内部资料-SQL性能优化3

    To make use of either more or less strict isolation levels in applications, locking can be customized for an entire session by setting the isolation level of the session with the SET TRANSACTION ...

    数位板压力测试

    This specification was developed in response to a perceived need for a standardized programming inter-face to digitizing tablets, three dimensional position sensors, and other pointing devices by a ...

    微软内部资料-SQL性能优化2

    By caching virtual blocks, the cache manager can reduce disk I/O and provide intelligent read ahead. Represented by Memory:Cache Resident bytes. For more information, see also… Inside Windows 2000...

    ms05039.rar

    RPC interface in Microsoft Windows. &lt;br&gt;Using a null session, an attacker could make an RPC request to the PnP interface on a Microsoft Windows system that could potentially execute arbitrary code....

    2009 达内Unix学习笔记

    其中,1是执行权(Execute),2是写权限(Write),4是读权限(Read), 具体权限相当于三种权限的数相加,如7=1+2+4,即拥有读写和执行权。 另外,临时文件/目录的权限为rwt,可写却不可删,关机后自动删除;建临时目录...

    Turbo C++ 3.0[DISK]

    programs and manuals, read this file in its entirety. TABLE OF CONTENTS ----------------- 1. How to Get Help 2. Installation 3. Features 4. Important Information 5. Testing Your Expanded Memory 6. ...

    Turbo C++ 3.00[DISK]

    programs and manuals, read this file in its entirety. TABLE OF CONTENTS ----------------- 1. How to Get Help 2. Installation 3. Features 4. Important Information 5. Testing Your Expanded Memory 6. ...

    ASP.NET MVC in Action

    ### ASP.NET MVC in Action: Key Insights and Knowledge Points ... Whether you're just starting out with ASP.NET MVC or looking to take your skills to the next level, this book is a must-read.

    ICS delphixe10源码版

    ICS has been designed by Fran鏾is PIETTE but many other peoples are working on the components and sample programs. The history of changes in each source file list all developers having contributed ...

    plsqldev14.0.0.1961x32多语言版+sn.rar

    Session Actions can display feedback by writing dbms_output. Other enhancements Function keys have been added for “Search Bar” functions (Focus, Search, Go to next, Go to previous). Substitution ...

    plsqldev14.0.0.1961x64多语言版+sn.rar

    Session Actions can display feedback by writing dbms_output. Other enhancements Function keys have been added for “Search Bar” functions (Focus, Search, Go to next, Go to previous). Substitution ...

    Oracle sqldeveloper without jdk (win+linux)

    - The script to which the character belongs is supported by the JRE installation on which SQL Developer is running � for example, appropriate fonts are available � and - The script does not ...

    Hibernate Reference Documentation3.1

    9.1.7. Mixing implicit polymorphism with other inheritance mappings 9.2. Limitations 10. Working with objects 10.1. Hibernate object states 10.2. Making objects persistent 10.3. Loading an object 10.4...

Global site tag (gtag.js) - Google Analytics