Common Wait Events in Oracle Real Application Clusters Environment

Embed Size (px)

Citation preview

  • 8/7/2019 Common Wait Events in Oracle Real Application Clusters Environment

    1/5

    Common Wait Events in Oracle Real Application Clusters

    Environment

    In this section we will discuss some of the common wait events that you will see in Oracle RealApplication Clusters (RAC) environment.

    global cache cr request

    When a session is looking for a consistent read (CR) copy of the buffer cached by the remoteinstance, it waits on the global cache cr requestevent till the buffer is available in the local instance.Normally the holder constructs the CR version of the buffer and ships it to the requesting instancethrough the high speed interconnect. The wait ends when the CR buffer arrives at the local buffercache.

    From Oracle Database 10gRelease 1, global cache cr requestwaits are known as gc cr requestwaits.

    Depending on the mode of the buffer held in the remote instance and the number of times the remoteinstance ships the CR copy to the local instance, one of the following will happen:

    The CR copy of the buffer is sent to the requesting instance and the fairness counter isincremented for that buffer. Subsequently the global cache cr blocks receivedstatistic isincremented.

    If the buffer is not cached by the remote instance (but mastered by the remote instance), itgrants it to the requesting instance. The session can read the block from the disk and the globalcache gets statistic is incremented.

    If the number of CR copies for that particular buffer reaches the _fairness_thresholdlimit, theremote instance downgrades the lock to null mode and flushes the redo to the disk. Thesession can do the disk I/O to get the block from the disk.

    In cases 2 and 3, the global cache cr requests waits are typically followed by the db filesequential reads and/ordb file scattered readwaits.

    Wait Parameters

    Wait parameters forglobal cache cr requestare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Table 3-3 lists the most commonly seen block classes.

    Table 3-3: Common Block Classes

    Block Class Description

    0 System rollback segment

    1 Data blocks

    2 Sort blocks

    3 Deferred rollback segment blocks (save undo)

    4 Segment header blocks

    5 Deferred rollback segment header blocks

    6 Freelist blocks

  • 8/7/2019 Common Wait Events in Oracle Real Application Clusters Environment

    2/5

    Table 3-3: Common Block Classes

    Block Class Description

    7 Extent map blocks

    8 Bitmapped space management blocks

    9 Space management index blocks

    10 Unused

    Wait Time

    The wait is up to one second between timeouts. The actual wait time will be until the buffer is cachedat the requesting instance in required compatible mode.

    buffer busy global cache

    When a session wants to modify a buffer that is cached in the remote instances, it waits on the bufferbusy global cache event. This is similar to buffer busy waitin single instance architecture. This waithappens at cache layer. In other words, the session is waiting for a buffer in local cache, which isbusy because it is waiting for a global cache request to complete. The wait at the RAC layer isaccounted in the global cache busywait event.

    From Oracle Database10gRelease 1, buffer busy global cache waits are known as gc buffer busywaits.

    Wait Parameters

    Wait parameters forbuffer busy global cache are described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The numeric code indicating the reason

    Wait Time

    The wait time is one second between timeouts.

    buffer busy global cr

    When more than one session is queued for a CR copy of the buffer in a same instance, and the CRcopy is expected from the remote instance, the session waits on the buffer busy global crwait event.Once the CR copy from the remote instance arrives at the local cache, the block SCN is comparedwith the snapshot SCN before the buffer can be used.

    From Oracle Database 10gRelease 1, this wait event is known as gc cr block busywaits.

    Wait Parameters

    Wait parameters forbuffer busy global crare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The numeric code indicating the reason

    Wait Time

    The wait time is one second between timeouts.

  • 8/7/2019 Common Wait Events in Oracle Real Application Clusters Environment

    3/5

    global cache busy

    When a session wants to modify a buffer that is held in a shared mode, it waits on the global cachebusywait event till it gets the buffer in current mode. This normally happens when an instance wantsto acquire a buffer from a remote instance and the lock convert or acquisition process is in progress.Normally, the segment header blocks, index branch blocks, and bitmap segment blocks are held inthe shared mode. During addition of new blocks to the segment, the buffer is transformed from shared

    current mode to exclusive current mode.

    Waits forglobal cache busyare usually followed by the global cache s to xwaits. Excessive waits forthese waits could be an indicator of slow interconnect or a delay in flushing the redo for that particularblock on the remote instance.

    Wait Parameters

    Wait parameters forglobal cache busyare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Wait Time

    The wait time is one second between timeouts.

    global cache null to x

    When a session wants to modify a block, it must hold that block in exclusive mode in its local cache.The session will wait forglobal cache null to xwait when the buffer is not in its local cache in anyother mode. If the buffer is in the global cache at the remote instance, the buffer is shipped to thelocal cache and the exclusive lock for that buffer is granted. The statistics global cache current blocksservedis incremented after the transfer.

    If it is not held in any other mode in remote cache, the lock is granted for that buffer from the GlobalCache Service (GCS) at the appropriate mode. Once the lock is granted for the buffer, disk I/O is

    done to read the buffer from the disk.

    Wait Parameters

    Wait parameters forglobal cache null to xare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Wait Time

    One second

    global cache null to s

    When a session wants to read a buffer, it has to convert f rom NULL mode to SHARED mode. Thebuffer can be read from the disk if it is not cached globally or can be obtained from the otherinstances cache through the interconnect.

    Wait Parameters

    Wait parameters forglobal cache null to s are described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer

  • 8/7/2019 Common Wait Events in Oracle Real Application Clusters Environment

    4/5

    P3 The lock element number or class of the buffer

    Wait Time

    One second

    global cache s to x

    The session waits forglobal cache s to xwhen it holds the buffer in SHARED mode and wants toconvert it to EXCLUSIVE (X) mode. If no other instances are holding that buffer in SHARED orEXCLUSIVE mode, the lock is immediately upgraded to X mode after incrementing the global cacheconverts counter. If any other instance is holding the buffer in SHARED mode, the lock mode isdowngraded to nullmode.

    Typically, index updates will result in global cache s to xwaits as you lock the buffer for SHAREDmode while traversing in the index tree. It will update the leaf block address in the branch block afterholding the buffer in EXCLUSIVEmode.

    Wait Parameters

    Wait parameters forglobal cache s to xare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Wait Time

    One second

    global cache open x

    A session waits for the global cache open xwait when it wants to modify the current block (usually forinserts and bulk loads), which is not cached in the local instance in any mode. The current block hasto come from the remote instance or from the disk. If the block is not cached in any of the caches and

    if that is a new block to the global cache, there is no lock conversion involved. The process is calledblock newing, and it happens during the new blocks allocated to the freelist chain or bitmapsegments.

    Wait Parameters

    Wait parameters forglobal cache open xare described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Wait Time

    One second

    global cache open s

    A session waits for the global cache open s when it reads the block in the buffer cache for the firsttime. This can happen during the startup or while reading a block that is the first-time read into thelocal buffer cache. The block can either be read from the disk or shipped from the other instancecache.

    Wait Parameters

  • 8/7/2019 Common Wait Events in Oracle Real Application Clusters Environment

    5/5

    Wait parameters forglobal cache open s are described here: P1 File number from which Oracle is reading the block P2 Block number from the file that Oracle wants to read into a buffer P3 The lock element number or class of the buffer

    Wait Time

    One second

    row cache lock

    The dictionary cache is known as row cache because it keeps the information at row level, asopposed to the buffer cache, which keeps the information at block level. The locks, which protect thedefinition of the data dictionary objects, are called row cache locks. Normally, DDL statements requirerow cache lock,and the session will wait for the row cache lockto lock the data dictionary information.

    This wait is not a RAC-specific wait. It is applicable in single instance also but has a bigger impact inthe RAC environment because the library cache and row cache are globally coordinated.

    Wait Parameters

    Wait parameters forrow cache lockare described here: P1 Cache ID of the row cache lock the session is waiting for; can be obtained from

    V$ROWCACHE P2 The mode in which the lock is held P3 The mode in which the lock is requested

    The following SQL can be used to find cache number from the V$ROWCACHE:

    select cache#, type, parameter

    from v$rowcache

    where cache# = &P1;

    Wait Time

    Three seconds between timeouts. After 100 timeouts, the process is rolled back and the sessionwrites: WAITEDTOOLONGFORAROWCACHEENQUEUELOCK in the alert.log, and the process isaborted.