a reference note for the wait event "buffer busy waits" which includes the following subsections:
- Brief definition
- Individual wait details (eg: For waits seen in )
- Systemwide wait details (eg: For waits seen in )
- Reducing waits / wait times
Definition:
Versions:7.0 - 9.2 Documentation: This wait happens when a session wants to access a database block in the buffer cache but it cannot as the buffer is "busy". The two main cases where this can occur are: Another session is reading the block into the buffer Another session holds the buffer in an incompatible mode to our requestIndividual Waits:
Parameters:
P1 = (Absolute File# in Oracle8 onwards) P2 = P3 = (Reason Code)to determine the tablespace, filename and object for this file#,block# pair.
shows that the "buffer busy wait" is waiting for a block read to complete then the blocking session is likely to be waiting on an IO wait (eg: "db file sequential read" or "db file scattered read") for the same file# and block#.
If the wait is due to the buffer being held in an incompatible mode then it should be freed very soon. If not then it is advisable to contact Oracle Support and get 3 SYSTEMSTATE dumps at one minute intervals as the blocking session may be spinning. (Look for ACTIVE sessions with high CPU utilisation).
Wait Time:
Normal wait time is 1 second. If the session has been waiting for an exclusive buffer during the last wait then it waits 3 seconds this wait. The session will keep timing-out/waiting until it acquires the buffer.
Finding Blockers:
Finding the blocking process can be quite difficult as the information required is not externalised. If
Systemwide Waits:
If the TIME spent waiting for buffers is significant then it is best to determine which segment/s is/are suffering from contention. The "Buffer busy wait statistics" section of the Bstat/estat or STATSPACK reports shows which block type/s are seeing the most contention. This information is derived from which can be queried in isolation:SELECT time, count, class FROM V$WAITSTAT ORDER BY time,count ;This shows the class of block with the most waits at the BOTTOM of the list.Oracle Support may also request that the following query be run to show where the block is held from when a wait occurs:Additional information regarding which files contain the blocks being waited for can be obtained from the internal thus:SELECT kcbwhdes, why0+why1+why2 "Gets", "OTHER_WAIT" FROM x$kcbsw s, x$kcbwh w WHERE s.indx=w.indx and s."OTHER_WAIT">0 ORDER BY 3 ; Note: "OTHER_WAIT" is "OTHER WAIT" in Oracle8i (a space rather than an underscore)SELECT count, file#, name FROM x$kcbfwait, v$datafile WHERE indx + 1 = file# ORDER BY count ;This shows the file/s with the most waits (at the BOTTOM of the list) so by combining the above of information we know what block type/s in which file/s are causing waits. The segments in each file can be seen using a query like:SELECT distinct owner, segment_name, segment_type FROM dba_extents WHERE file_id= ;If there are a large number of segments of the type listed then monitoring may help isolate which object is causing the waits.
Eg: Repeatedly run the following statement and collect the output. After a period of time sort the results to see which file & blocks are showing contention:SELECT p1 "File", p2 "Block", p3 "Reason" FROM v$session_wait WHERE event='buffer busy waits' ;Note:
In the above query there is no reference to WAIT_TIME as you are not interested in whether a session is currently waiting or not, just what buffers are causing waits.If a particular block or range of blocks keep showing waits you can try to isolate the object using the queries in
One can also look at:
Capturing session trace and noting the "buffer busy waits" may help - See .
Reducing Waits / Wait times:
As buffer busy waits are due to contention for particular blocks then you cannot take any action until you know which blocks are being competed for and why. Eliminating the cause of the contention is the best option. Note that "buffer busy waits" for data blocks are often due to several processes repeatedly reading the same blocks (eg: if lots of people scan the same index) - the first session processes the blocks that are in the buffer cache quickly but then a block has to be read from disk - the other sessions (scanning the same index) quickly 'catch up' and want the block which is currently being read from disk - they wait for the buffer as someone is already reading the block in.Note 181306.1. file# 9.0The following hints may be useful for particular types of contention - these are things that MAY reduce contention for particular situations:
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/39335/viewspace-351721/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/39335/viewspace-351721/