|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Oracle Real-Time Wait Events v$system_event While tuning disk I/O waits is an important task, it
should not be considered as a comprehensive approach to Oracle tuning.
select *
EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT --------------------- ----------- -------------- ----------- ------------ buffer busy waits 636528 1557 549700 .863591232 write complete waits 1193 0 14799 12.4048617 free buffer waits 1601 0 622 .388507183
The type of buffer that causes the wait can be queried using the v$waitstat view. This view lists the waits per buffer type for buffer busy waits, where count is the sum of all waits for the class of block, and time is the sum of all wait times for that class:
select *
CLASS COUNT TIME ------------------ ---------- ---------- data block 1961113 1870278 segment header 34535 159082 undo header 233632 86239 undo block 1886 1706
Buffer busy waits occur when an Oracle session needs to access a block in the buffer cache, but cannot because the buffer copy of the data block is locked. This buffer busy wait condition can happen for either of the following reasons:
Since buffer busy waits are due to contention between particular blocks, there's nothing that can be done until the DBA knows which blocks are in conflict and why the conflicts are occurring. Tuning, therefore, involves identifying and eliminating the cause of the block contention.
SQL> desc v$session_wait
Name Null? Type ----------------------------------------- -------- ---------------- SID NUMBER SEQ# NUMBER EVENT VARCHAR2(64) P1TEXT VARCHAR2(64) P1 NUMBER P1RAW RAW(4) P2TEXT VARCHAR2(64) P2 NUMBER P2RAW RAW(4) P3TEXT VARCHAR2(64) P3 NUMBER P3RAW RAW(4) WAIT_TIME NUMBER SECONDS_IN_WAIT NUMBER STATE VARCHAR2(19)
The columns of the v$session_wait view that are of particular interest for a buffer busy wait event are:
The following is an Oracle data dictionary query for these values: select
If the output from repeatedly running the above query shows that a block or range of blocks is experiencing waits, the following query should be used to show the name and type of the segment:
select
Once the segment is identified, the
v$segment_statistics performance
view facilitates real time monitoring of segment level statistics. This
enables a DBA to identify performance problems associated with individual
tables or indexes, as shown below.
select
The output looks like the following:
OBJECT_NAME STATISTIC_NAME VALUE ----------- ------------------------- ---------- SOURCE$ logical reads 11216 SOURCE$ buffer busy waits 210 SOURCE$ db block changes 32 SOURCE$ physical reads 10365 SOURCE$ physical writes 0 SOURCE$ physical reads direct 0 SOURCE$ physical writes direct 0 SOURCE$ ITL waits 0 SOURCE$ row lock waits
< system_waits.sql
select event, total_waits, round(100 * (total_waits / sum_waits),2) pct_waits, time_wait_sec, round(100 * (time_wait_sec / greatest(sum_time_waited,1)),2) pct_time_waited, total_timeouts, round(100 * (total_timeouts / greatest(sum_timeouts,1)),2) pct_timeouts, average_wait_sec from (select event, total_waits, round((time_waited / 100),2) time_wait_sec, total_timeouts, round((average_wait / 100),2) average_wait_sec from sys.v_$system_event where event not in ('lock element cleanup', 'pmon timer', 'rdbms ipc message', 'rdbms ipc reply', 'smon timer', 'SQL*Net message from client', 'SQL*Net break/reset to client', 'SQL*Net message to client', 'SQL*Net more data from client', 'dispatcher timer', 'Null event', 'parallel query dequeue wait', 'parallel query idle wait - Slaves', 'pipe get', 'PL/SQL lock timer', 'slave wait', 'virtual circuit status', 'WMON goes to sleep', 'jobq slave wait', 'Queue Monitor Wait', 'wakeup time manager', 'PX Idle Wait') AND event not like 'DFS%' AND event not like 'KXFX%'), (select sum(total_waits) sum_waits, sum(total_timeouts) sum_timeouts, sum(round((time_waited / 100),2)) sum_time_waited from sys.v_$system_event where event not in ('lock element cleanup', 'pmon timer', 'rdbms ipc message', 'rdbms ipc reply', 'smon timer', 'SQL*Net message from client', 'SQL*Net break/reset to client', 'SQL*Net message to client', 'SQL*Net more data from client', 'dispatcher timer', 'Null event', 'parallel query dequeue wait', 'parallel query idle wait - Slaves', 'pipe get', 'PL/SQL lock timer', 'slave wait', 'virtual circuit status', 'WMON goes to sleep', 'jobq slave wait', 'Queue Monitor Wait', 'wakeup time manager', 'PX Idle Wait') AND event not like 'DFS%' AND event not like 'KXFX%') order by 4 desc, 1 asc;
The output of this script, in the Ion tool, looks like the following:
Figure 13.X: Output of system_waits.sql from Ion tool
The main wait class within ASH that relates to user I/O
can be determined with the following script: Its output looks like this:
SID USERNAME WAIT_CLASS TOTAL_WAITS TIME_WAITED ---------- -------------------- -------------------- ----------- ----------- 131 SYSMAN User I/O 11 5 132 SYSMAN User I/O 3 2 133 SYSMAN User I/O 13 7 134 SYSMAN User I/O 173 97 138 SPV User I/O 10 3 140 SYSMAN User I/O 387 413 141 DBSNMP User I/O 201 433 142 SYSMAN User I/O 36 71 144 SYSMAN User I/O 6 7 146 SYSMAN User I/O 35 28 149 SYSMAN User I/O 46 42 154 DBSNMP System I/O 84 68 160 SYS System I/O 5 3 162 SYSMAN User I/O 16 10
SEE CODE DEPOT FOR FULL SCRIPTS
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 1996 - 2011 by
Burleson Enterprises. All rights reserved.
Oracle® is the registered trademark
of Oracle Corporation. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||