Oracle Wait Events Cheat Sheet - Performance Tuning Quick Reference
Oracle Wait Events Cheat Sheet
Section titled “Oracle Wait Events Cheat Sheet”Quick reference for understanding and troubleshooting Oracle database wait events.
Top Wait Events Query
Section titled “Top Wait Events Query”-- Current top wait eventsSELECT EVENT, TOTAL_WAITS, TIME_WAITED_MICRO/1000000 AS time_waited_sec, AVERAGE_WAIT/100 AS avg_wait_sec, WAIT_CLASSFROM V$SYSTEM_EVENTWHERE WAIT_CLASS != 'Idle'ORDER BY TIME_WAITED_MICRO DESCFETCH FIRST 20 ROWS ONLY;Wait Event Categories
Section titled “Wait Event Categories”| Wait Class | Description | Common Events |
|---|---|---|
| User I/O | Disk reads for user queries | db file sequential read, db file scattered read |
| System I/O | Background process I/O | log file sync, control file I/O |
| Concurrency | Lock contention | buffer busy waits, library cache lock |
| Commit | Transaction commit | log file sync |
| Application | Application-level waits | enq: TX - row lock contention |
| Configuration | Resource limits | log buffer space |
| Network | Network waits | SQL*Net message |
| Idle | Session waiting for work | SQL*Net message from client |
I/O Wait Events
Section titled “I/O Wait Events”db file sequential read
Section titled “db file sequential read”Single block read (index lookup)
-- Find sessions waiting on db file sequential readSELECT SID, SERIAL#, USERNAME, SQL_ID, EVENT, P1, P2, P3FROM V$SESSIONWHERE EVENT = 'db file sequential read';-- P1=file#, P2=block#, P3=blocks
-- Find hot objects causing waitsSELECT o.OWNER, o.OBJECT_NAME, o.OBJECT_TYPE, COUNT(*) AS wait_countFROM V$ACTIVE_SESSION_HISTORY ashJOIN DBA_OBJECTS o ON ash.CURRENT_OBJ# = o.OBJECT_IDWHERE ash.EVENT = 'db file sequential read' AND ash.SAMPLE_TIME > SYSDATE - 1/24GROUP BY o.OWNER, o.OBJECT_NAME, o.OBJECT_TYPEORDER BY COUNT(*) DESCFETCH FIRST 10 ROWS ONLY;Resolution: Tune SQL, add indexes, increase buffer cache, faster storage.
db file scattered read
Section titled “db file scattered read”Multi-block read (full table scan)
-- Find full table scans causing waitsSELECT o.OWNER, o.OBJECT_NAME, s.SQL_ID, s.SQL_TEXTFROM V$SESSION sJOIN DBA_OBJECTS o ON s.ROW_WAIT_OBJ# = o.OBJECT_IDWHERE s.EVENT = 'db file scattered read';Resolution: Add indexes, partition tables, increase DB_FILE_MULTIBLOCK_READ_COUNT.
direct path read/write
Section titled “direct path read/write”Parallel queries, temp segments, LOBs
-- Check parallel operationsSELECT SID, SQL_ID, EVENT, P1TEXT || '=' || P1 AS detailFROM V$SESSIONWHERE EVENT LIKE 'direct path%';Resolution: Normal for parallel queries. For temp waits, increase temp tablespace or tune queries.
Log/Commit Wait Events
Section titled “Log/Commit Wait Events”log file sync
Section titled “log file sync”Waiting for redo to write to disk on COMMIT
-- Check log file sync waitsSELECT EVENT, TOTAL_WAITS, AVERAGE_WAIT/100 AS avg_wait_secFROM V$SYSTEM_EVENTWHERE EVENT = 'log file sync';
-- Check log writer performanceSELECT NAME, VALUEFROM V$SYSSTATWHERE NAME LIKE 'redo%';Resolution: Faster redo log storage (SSD), reduce commit frequency, batch commits.
log buffer space
Section titled “log buffer space”Log buffer too small
-- Check log buffer configurationSHOW PARAMETER log_buffer;
-- Check log buffer waitsSELECT * FROM V$SYSSTAT WHERE NAME LIKE '%log buffer%';Resolution: Increase LOG_BUFFER or use faster redo storage.
log file switch
Section titled “log file switch”-- log file switch (checkpoint incomplete)-- Log files too small, checkpoint not complete
SELECT GROUP#, STATUS, BYTES/1024/1024 AS size_mb FROM V$LOG;Resolution: Add more/larger redo log groups, tune checkpoint.
Buffer Pool Wait Events
Section titled “Buffer Pool Wait Events”buffer busy waits
Section titled “buffer busy waits”Contention on hot blocks
-- Find hot blocksSELECT o.OWNER, o.OBJECT_NAME, o.OBJECT_TYPE, ash.CURRENT_FILE#, ash.CURRENT_BLOCK#, COUNT(*) AS waitsFROM V$ACTIVE_SESSION_HISTORY ashJOIN DBA_OBJECTS o ON ash.CURRENT_OBJ# = o.OBJECT_IDWHERE ash.EVENT = 'buffer busy waits' AND ash.SAMPLE_TIME > SYSDATE - 1/24GROUP BY o.OWNER, o.OBJECT_NAME, o.OBJECT_TYPE, ash.CURRENT_FILE#, ash.CURRENT_BLOCK#ORDER BY COUNT(*) DESCFETCH FIRST 10 ROWS ONLY;Resolution: Reduce contention via partitioning, reverse key indexes, hash partitioning.
free buffer waits
Section titled “free buffer waits”No free buffers in buffer cache
-- Check buffer cache usageSELECT NAME, BLOCK_SIZE, CURRENT_SIZE/1024/1024 AS current_mb, BUFFERSFROM V$BUFFER_POOL;Resolution: Increase buffer cache (DB_CACHE_SIZE), check for inefficient queries.
read by other session
Section titled “read by other session”Block being read by another session
-- Find concurrent block readersSELECT SID, SERIAL#, EVENT, P1, P2, SQL_IDFROM V$SESSIONWHERE EVENT = 'read by other session';Resolution: Usually transient. If persistent, investigate the SQL reading the same blocks.
Lock/Enqueue Wait Events
Section titled “Lock/Enqueue Wait Events”enq: TX - row lock contention
Section titled “enq: TX - row lock contention”Row-level lock contention
-- Find blocking sessionsSELECT s1.SID AS blocked_sid, s1.USERNAME AS blocked_user, s2.SID AS blocking_sid, s2.USERNAME AS blocking_user, s1.EVENT, s1.SQL_IDFROM V$SESSION s1JOIN V$SESSION s2 ON s1.BLOCKING_SESSION = s2.SIDWHERE s1.EVENT LIKE 'enq: TX%';Resolution: Application design, reduce transaction scope, timeout handling.
enq: TM - contention
Section titled “enq: TM - contention”Table-level lock (usually DML on unindexed FK)
-- Find missing indexes on foreign keysSELECT c.TABLE_NAME, c.CONSTRAINT_NAME, cc.COLUMN_NAMEFROM DBA_CONSTRAINTS cJOIN DBA_CONS_COLUMNS cc ON c.CONSTRAINT_NAME = cc.CONSTRAINT_NAMEWHERE c.CONSTRAINT_TYPE = 'R' AND NOT EXISTS ( SELECT 1 FROM DBA_IND_COLUMNS ic WHERE ic.TABLE_NAME = c.TABLE_NAME AND ic.COLUMN_NAME = cc.COLUMN_NAME );Resolution: Add indexes on foreign key columns.
library cache lock/pin
Section titled “library cache lock/pin”Shared pool contention
-- Check library cache statsSELECT NAMESPACE, GETS, GETHITS, PINS, PINHITS, INVALIDATIONSFROM V$LIBRARYCACHE;Resolution: Reduce hard parsing (use bind variables), increase shared pool.
Network Wait Events
Section titled “Network Wait Events”SQL*Net message from client
Section titled “SQL*Net message from client”Idle wait - client think time
This is an idle wait. High values indicate application processing time between database calls.
SQL*Net message to client
Section titled “SQL*Net message to client”Sending data to client
-- Check network waitsSELECT EVENT, TIME_WAITED_MICRO/1000000 AS secsFROM V$SESSION_EVENTWHERE SID = &sid AND EVENT LIKE 'SQL*Net%';Resolution: Network latency, result set size, fetch size.
SQL*Net more data to client
Section titled “SQL*Net more data to client”Large result sets
Resolution: Reduce result set size, increase SDU_SIZE.
Cluster Wait Events (RAC)
Section titled “Cluster Wait Events (RAC)”gc buffer busy
Section titled “gc buffer busy”Global cache block contention
-- Check GC waitsSELECT EVENT, TOTAL_WAITS, TIME_WAITED_MICRO/1000000 AS secsFROM V$SYSTEM_EVENTWHERE EVENT LIKE 'gc%'ORDER BY TIME_WAITED_MICRO DESC;gc cr/current block receive
Section titled “gc cr/current block receive”Receiving blocks from remote instance
Resolution: Reduce inter-instance traffic, application partitioning.
Session Wait Analysis
Section titled “Session Wait Analysis”Current Session Waits
Section titled “Current Session Waits”SELECT SID, SERIAL#, USERNAME, STATUS, EVENT, WAIT_CLASS, SECONDS_IN_WAIT, STATE, SQL_IDFROM V$SESSIONWHERE USERNAME IS NOT NULL AND WAIT_CLASS != 'Idle'ORDER BY SECONDS_IN_WAIT DESC;Historical Wait Analysis (ASH)
Section titled “Historical Wait Analysis (ASH)”SELECT EVENT, COUNT(*) AS samples, ROUND(COUNT(*) * 100 / SUM(COUNT(*)) OVER(), 2) AS pctFROM V$ACTIVE_SESSION_HISTORYWHERE SAMPLE_TIME > SYSDATE - 1/24 AND WAIT_CLASS != 'Idle'GROUP BY EVENTORDER BY COUNT(*) DESCFETCH FIRST 10 ROWS ONLY;Wait Event Resolution Quick Reference
Section titled “Wait Event Resolution Quick Reference”| Wait Event | Likely Cause | Resolution |
|---|---|---|
| db file sequential read | Index lookups, disk I/O | Tune SQL, increase buffer cache |
| db file scattered read | Full table scans | Add indexes, partition |
| log file sync | Slow redo writes | Faster storage, batch commits |
| buffer busy waits | Hot blocks | Partitioning, hash clusters |
| enq: TX - row lock | Row contention | Application design |
| library cache lock | Hard parsing | Bind variables |
| latch: cache buffers chains | Buffer chain contention | Reduce logical I/O |
| cursor: pin S wait on X | Cursor contention | Reduce version count |