Resolving
common Oracle Wait Events using the Wait Interface
|
Wait
Event |
Possible Causes |
Actions |
Remarks |
|
db file sequential
reads |
Use of
an unselective index Fragmented Indexes High
I/O on a particular disk or mount point Bad
application design Index
reads performance can be affected by |
Check
indexes on the table to ensure Check
the column order of the index Rebuild
indexes with a high clustering Use
partitioning to reduce the amount Make
sure optimizer statistics are up Relocate ‘hot’ datafiles Consider the usage of multiple buffer Inspect
the execution plans of the Is it
appropriate for the SQL Is the
application an online transaction Would
full table scans be more Do the
statements use the right driving The
optimization goal is to minimize |
The
Oracle process wants a block that is currently not in the SGA, and it is
waiting for the database block to be read into the SGA from
disk. Significant db file sequential read wait time is most
likely an application issue. If
the DBA_INDEXES.CLUSTERING_FACTOR of the index approaches the
number of blocks in the table, then most of the rows in the table are
ordered. This is desirable. However, if the clustering factor
approaches the number of rows in the table, it means the rows in the table
are randomly ordered and thus it requires more I/Os to complete the
operation. You can improve the index’s clustering factor by rebuilding the
table so that rows are ordered according to the index key and rebuilding
the index thereafter. The
OPTIMIZER_INDEX_COST_ADJ and OPTIMIZER_INDEX_CACHING initialization
parameters can influence the optimizer to favour the nested loops
operation and choose an index access path over a full table
scan. Tuning
I/O related waits Note# 223117.1 db file
sequential read Reference Note# 34559.1 |
|
db file scattered
reads |
The
Oracle session has requested and is Full
Table scans Fast
Full Index Scans |
Optimize multi-block I/O by setting the Partition pruning to reduce number of Consider the usage of multiple buffer Optimize the SQL statement that Should
the statement access the data Does
the query use the right driving Are the
SQL predicates appropriate If full scans are appropriate, can
The
objective is to reduce the Make
sure all statistics are |
If an
application that has been running fine for a while suddenly clocks a lot
of time on the db file scattered read event and there hasn’t been a
code change, you might want to check to see if one or more indexes has
been dropped or become unusable. db file
scattered read Reference Note# 34558.1 |
|
log file parallel
write |
LGWR
waits while writing contents of the I/O
wait on sub system holding the online |
Reduce
the amount of redo being Do not
leave tablespaces in hot Do not
use RAID 5 for redo log files Use
faster disks for redo log files Ensure
that the disks holding the Consider using NOLOGGING or |
Reference Note# 34583.1 |
|
log file
sync |
Oracle
foreground processes are waiting |
Tune
LGWR to get good throughput to Reduce
overall number of commits by |
Reference Note# 34592.1 High
Waits on log file sync Note# 125269.1 Tuning
the Redolog Buffer Cache and Resolving Redo Latch
Contention Note#
147471.1 |
|
buffer busy
waits |
Buffer
busy waits are common in an I/O- The two
main cases where this can occur Another
session is reading the block into the Another
session holds the buffer in an These waits
indicate read/read, read/write, The
Oracle session is waiting to pin a buffer. This
wait can be intensified by a large block This
wait happens when a session wants to It is
also often due to several processes |
The
main way to reduce buffer busy Depending on the block type, the Data
Blocks Eliminate HOT blocks from the Check
for repeatedly scanned / Try rebuilding the object with a higher
Increase INITRANS and MAXTRANS
Reduce
the number of rows per block Segment
Header Increase of number of FREELISTs Undo
Header Increase the number of Rollback
|
A
process that waits on the buffer busy waits event publishes the
reason code in the P3 parameter of the wait event. The
Oracle Metalink note # 34405.1
provides a table of reference - codes 130 and 220 are the most
common. Resolving intense and random buffer busy wait performance
problems. Note# 155971.1 |
|
free buffer
waits |
This
means we are waiting for a free buffer Either
the buffer cache is too small or the DBWR is
unable to keep up to the write Checkpoints happening too fast – maybe due Large
sorts and full table scans are filling the If
the number of dirty buffers
that need to be |
Reduce
checkpoint frequency -
Examine
the size of the buffer cache Set disk_asynch_io = true setIf not using asynchronous I/O
Ensure
hot spots do not exist by Pre-sorting or reorganizing data can
|
Understanding
and Tuning Buffer Cache and DBWR Note# 62172.1 How to
Identify a Hot Block within the database Buffer Cache.
Note#
163424.1 |
|
enqueue
waits |
This
wait event indicates a wait for a lock TX
Transaction Lock Generally due to table or application set up This
indicates contention for row-level lock. This
usually is an application issue. TM DML
enqueue lock Generally due to application issues, ST lockDatabase actions that modify the UET$ (usedContention for the ST lock indicates there are
|
Reduce
waits and wait times The
action to take depends on the lock Whenever you see an enqueue wait Waits
for TM enqueue in Mode 3 are primarily due to unindexed foreign key
columns. Create
indexes on foreign keys <
10g Following are some of the things you Use locally managed tablespaces
Recreate all temporary tablespaces
|
Maximum
number of enqueue resources that can be concurrently locked is controlled
by the ENQUEUE_RESOURCES parameter. Reference Note# 34566.1 Tracing sessions waiting on an enqueue Note# 102925.1 Details
of V$LOCK view and lock modes Note:29787.1 |
|
Cache buffer chain
latch |
This
latch is acquired when searching for
data blocks Hot
blocks are another common SQL statements
with high Multiple concurrent sessions are |
Reducing contention for the cache Exporting the table, increasing the Minimizing the number of records per For
indexes, you can rebuild them Consider reducing the block size Starting in
Oracle9i Database, Oracle |
The
default number of hash latches is usually 1024 The
number of hash latches can be adjusted by the parameter
_DB_BLOCKS_HASH_LATCHES |
|
Cache buffer LRU chain
latch |
Processes need to get this latch when they The
cache buffer lru chain latch is acquired Competition for the cache buffers lru chain Heavy contention for this latch is generally |
Contention in this latch can be Its
possible to reduce |
|
|
Direct Path
Reads |
These
waits are associated with direct read operations which read data directly
into the sessions PGA bypassing the SGA The
"direct path read" and "direct path write" wait events are related to
operations that are performed in PGA like sorting, group by operation,
hash join In DSS
type systems, or during heavy batch periods, waits on "direct path read"
are quite normal However, for an OLTP system these waits are
significant These
wait events can occur during sorting operations which is not surprising as
direct path reads and writes usually occur in connection with temporary
tsegments SQL
statements with functions that require sorts, such as ORDER BY, GROUP BY,
|
Ensure
the OS asynchronous IO is configured correctly. Check
for IO heavy sessions / SQL and see if the amount of IO can be reduced.
Ensure
no disks are IO bound. Set
your PGA_AGGREGATE_TARGET to appropriate value (if the parameter
WORKAREA_SIZE_POLICY = AUTO) Or set
*_area_size manually (like sort_area_size and then you have to set
WORKAREA_SIZE_POLICY = MANUAL Whenever possible use UNION ALL instead of Make sure the optimizer selects the
right driving table. Check to see if the composite index’s columns can be
rearranged to match the ORDER BY clause to avoid sort entirely.
Also,
consider automating the SQL work areas using PGA_AGGREGATE_TARGET in
Oracle9i Database. Query
V$SESSTAT> to identify sessions with high "physical reads
direct" |
Default
size of HASH_AREA_SIZE is
twice that of SORT_AREA_SIZE Larger
HASH_AREA_SIZE will influence optimizer to go for hash joins instead of
nested loops Hidden
parameter DB_FILE_DIRECT_IO_COUNT can impact the direct path read
performance.It sets the maximum I/O buffer size of direct read and write
operations. Default is 1M in 9i |
|
Direct Path Writes
|
These
are waits that are associated with Direct
load operations (eg: Create Table as Parallel DML operations Sort IO
(when a sort does not fit in memory |
If the file indicates a temporary Ensure Ensure the OS asynchronous IO is Ensure no disks are IO bound |
|
|
Latch Free
Waits |
This
wait indicates that the process is When
you see a latch free wait event in the |
If the
TIME spent waiting for latches is |
A latch
is a kind of low level lock. Latches
apply only to memory The
time spent on latch waits is an What
are Latches and what causes Database Lock and Latch Information |
|
Library cache
latch |
The
library cache latches protect the Application is making heavy use of literal |
Latch
is to ensure that the application You can
reduce the library cache Consider increasing shared pool |
Larger
shared pools tend to have if your
database is not yet on |
|
Shared pool
latch |
The
shared pool latch is used to protect Contentions for the shared pool and library
The
cost of parsing a new SQL statement is |
Ways to
reduce the shared pool latch Eliminating literal SQL is also useful to The
workaround is to set the |
<Note
62143.1>
explains how to |
|
Row cache objects
latch |
This
latch comes into play when user |
It is
not common to have contention in Use Locally Managed tablespaces for Review and amend your database |
Configuring the library cache to an |