www.pafumi.net-tune redo log buffer.html

Upload: balajismith

Post on 06-Jul-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 Www.pafumi.net-Tune Redo Log Buffer.html

    1/3

    TUNING THE REDOLOG BUFFER (from ML 147471.1)

    1. What is the Redolog BufferThe redo log buffer is a circular buffer in the SGA that holds info rmation about changes made to the database. This information is sto red inredo entries. Redo entries contain the information necessary to reconstruct, o r redo, changes made to the database . Redo ent ries are usedfor database recovery, if necessary.Redo entries are copied by Oracle server processes from the user's memory space to the redo log buffer in the SGA. The redo entries take

    up cont inuous, sequential space in the buffer. The background process LGWR writes the redo log buffer to the active online redo log f ile (or group of f iles) on disk.The init ializat ion parameter LOG_BUFFER determines the size (in bytes) of the redo log buffer. In general, larger values reduce log f ile I/O,particularly if t ransactions are long or numerous. The default set t ing is four t imes the maximum data block size fo r the host operatingsystem.

    2. Redolog LatchesWhen a change to a data block needs to be done, it requires to create a redo record in the redolog buffer

    The database has three redo latches to handle this process:

    Redo Copy latchThe redo copy latch is acquired fo r the whole duration of the process described above. The init.oraLOG_SIMULTANEOUS_COPIES determines the number of redo copy latches. It is only released when a log switch is generated t orelease free space and re-acquired once the log switch ends.

    Redo allocat ion latchThe redo allocation latch is acquired to allocate memory space in the log buffer. Before Oracle9.2, the redo allocation latch isunique and thus serializes the writing of entries to the log buffer cache of the SGA. In Oracle 9.2. Entreprise Edition, the number of redo allocat ion latches is determined by init.ora LOG_PARALLELISM. The redo allocat ion latch allocates space in the logbuff er cache for each transaction ent ry. If t ransactions are small, or if there is only one CPU on the server, then t he redoallocat ion latch also copies the t ransaction data into the log buf fer cache. If a logswitch is needed to get f ree space this latch is

    released as well with the redo copy latch.Redo writing latch

    This unique latch prevent multiple processes post ing the LGWR process requesting log switch simultaneously. A process thatneeds free space must acquire the latch befo re of deciding whether to post the LGWR to perform a write, execute a log switchor just wait.

    In Oracle9.2, multiple redo allocation latches become possible with init.ora LOG_PARALLELISM. The log buffer is split in mult ipleLOG_PARALLELISM areas that each have a size of init.ora LOG_BUFFER. The allocation job o f each area is prot ected by a specif ic redo

     

    PDFmyURL.com

    http://pdfmyurl.com/?otsrc=watermark&otclc=0.01http://pdfmyurl.com/?otsrc=watermark&otclc=0.01

  • 8/17/2019 Www.pafumi.net-Tune Redo Log Buffer.html

    2/3

    allocation latch. The number of redo copy latches is still determined by the number of cpus

    4. Detecting and Resolving Redolog Buffer Performance Problem

    Content ion in the redolog buf fer will impact t he performance of the database since all DML and DDL must record a entry before of beingexecuted. Content ion can be seen as a latch contention o r as excessive request f or f ree space in the log buff er.Note: In general log buff er content ion is not frequent problem unless the latches already mentioned are consistently in the topwait events. Experience usually shows redo IO t hroughput is t he main culprit of redo contention.

    The database allow you to detect both types of contention as described below:

    Latch contention

    The f ollowing query determines the miss ratio and the "immediate" miss ratio for redolog latches.

    SELECT substr(ln.name, 1, 20), gets, misses, immediate_gets, immediate_missesFROM v$latch l, v$latchname lnWHERE ln.name in ('redo allocation', 'redo copy')and ln.latch# = l.latch#;

    If the ratio of MISSES to GETS exceeds 1%, or the ratio of IMMEDIATE_MISSES to (IMMEDIATE_GETS + IMMEDIATE_MISSES)exceeds 1%, there is latch content ion.

    Note: Oracle recommends to tune first the redo allocation latch rather than the redo copy latch.

    In Oracle 9.2:If the content ion is caused by redo allocation latch you can try to increase their number via init.ora LOG_PARALLELISMIf you f ind redo copy latch cont ent ion, you can increase the hidden init.ora _LOG_SIMULTANEOUS_COPIES to have more latchesavailable. The def ault is twice the numbers of CPUs.

    Request for space contention

    The statistic "redo log space requests" reflects t he number of t imes a user process waits fo r space in the redo log file, not the buf fer space .. This stat istic is available through the dynamic performance table V$SYSSTAT. By default, this table is only available to t heuser SYS and to users granted SELECT ANY TABLE system privilege, such as SYSTEM. Monitor this stat istic over a period of t imewhileyour application is running with this query:

      SELECT name, valueFROM v$sysstatWHERE name = 'redo log space requests';

     

    PDFmyURL.com

    http://pdfmyurl.com/?otsrc=watermark&otclc=0.01http://pdfmyurl.com/?otsrc=watermark&otclc=0.01

  • 8/17/2019 Www.pafumi.net-Tune Redo Log Buffer.html

    3/3

    The value of "redo log space requests" should be near 0. If this value increments consistently, processes have had to wait for space inthe buff er. This may be caused the checkpointing or log switching. Improve thus the checkpoint ing or archiving process.

     PDFmyURL.com

    http://pdfmyurl.com/?otsrc=watermark&otclc=0.01http://pdfmyurl.com/?otsrc=watermark&otclc=0.01