 |
|
Oracle redo allocation latch misses
Oracle Database Tips by Donald Burleson |
Question:
In my STATSPACK report I see high miss values
for redo allocation latch. What do I
do to relieve the misses on the redo
allocation latch?
Answer:
In the latch section of a STRATSPACK or AWR
report you should look for the
redo allocation line where ?pct get miss? >
0.1 OR ?pct nowait miss? > 1.0.
The redo allocation latch controls the
allocation of space for redo entries in the
redo log buffer (as defined by the
log_buffer parameter). The redo allocation
latch is a serialization latch that enforces
the sequence of entries in the log buffer.
A process can only write a redo entry after
the redo allocation latch, which is why it's
a will-to-wait latch.
Redo allocation latches are a willing-to-wait
latch, and the traditional remedy was to
increase the size of the
log_small_entry_max_size parameter, but
this parameter was removed in Oracle8i.
You can measure redo allocation latch misses
with this query:
select
round(
greatest(
(sum(decode(ln.name,'redo allocation',misses,0))
/greatest(sum(decode(ln.name,'redo
allocation',gets,0)),1)),
(sum(decode(ln.name,'redo
allocation',immediate_misses,0))
/greatest(sum(decode(ln.name,'redo
allocation',immediate_gets,0))
+sum(decode(ln.name,'redo
allocation',immediate_misses,0)),1))
)*100,2)
from
v$latch l,
v$latchname ln
where
l.latch#=ln.latch#;
Oracle consultant
Steve Adams notes on on redo allocation
latch tuning:
"The
redo latches are not only taken in connection with redo generation and log
file sync waits. They are taken by LGWR as well in connection with writing
redo from the log buffer to the log files.
When LGWR wakes up, it first takes the redo writing latch to update the SGA
variable that shows whether it is active. This prevents other processes from
posting LGWR needlessly. Then, if it was not posted, LGWR then takes the
redo allocation latch to determine whether there is any redo to write. If
not, it takes the redo writing latch again to record that it is no longer
active, before starting another rdbms ipc message wait.
If there is any redo to write, LGWR then inspects the latch recovery areas
for the redo copy latches (without taking the latches) to determine whether
there are any incomplete copies into the redo buffers that it intends to
write. If so, LGWR sleeps on a LGWR wait for redo copy wait event, and is
posted when the required copy latches have been released. The time taken by
LGWR to take the redo writing latch, the redo allocation latch and to wait
for the redo copy latches is accumulated in the redo writer latching time
statistic."