Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Redo Waits             Kyle Haileyhttp://perfvision.com/ftp/emea2010  Kyle.hailey@embarcadero.com                         ...
In This Section:1.   Log Buffer Space2.   Log File Sync3.   Log File Switch Completion4.   Log File Switch (checkpoint inc...
Log File Waits                    SGA           Log    Library Buffer           Buffer Cache Cache                       B...
Log File Operations Redo is written to disk when   User commits   Log Buffer 1/3 full (_log_io_size)   Log Buffer fill...
log buffer space Wait for space in the redo log buffer in SGA Solution  1.   Increase log_buffer parameter in init.ora  ...
Log Buffer Space                      SGA             Log    Library Buffer             Buffer Cache Cache                ...
log file sync Wait for redo flush upon:   Commit   Rollback Arguments   P1 = buffer# in log buffer that needs to be f...
Log File Sync                     SGA            Log    Library Buffer            Buffer Cache Cache                      ...
Log File Sync: Solutions Commit less        Often possible in loops that commit every loop             Commit every 50 ...
Log File Sync depends on: log file parallel write    Time   it takes for LGWR to write out changes If log file sync =~ ...
Separating LGWR and ARCH LGWR                                         ARCH          Redo 1                    Redo 2      ...
Log file switch completion No p1,p2,p3 Wait for lgwr to switch log files when generating  redo Solution:   Increase   ...
log file switch completion                                                                 Block xxxx                     ...
log file switch (checkpoint incomplete)  No p1,p2,p3 args  Wait for checkpoint to complete because all log   files are f...
log file switch (checkpoint incomplete) : DiagSessions                SGA                              Checkpoint 1   1wri...
log file switch (archiving needed) No p1,p2,p3 Database “hangs” for transactions  archive log stop;  -- make room in log...
log file switch (archiving needed)                         :                        SGA               Log    Library Buffe...
switch logfile command Same as log file switch completion but the  command is executed by the dba   Alter   system switc...
Concerns – Recovery Time What happens to recovery time if I change my redo  log file sizes Larger Redo Log size can incr...
Incremental Checkpoints (9iR2+)  FAST_START_MTTR_TARGET     Seconds   to Recovery     Easy and accuracy     Is overrid...
Recovery and Checkpoints                          SGA                 Log    Library Buffer                   DBWR        ...
DBWR dirty List and LGWR                           Buffers                                                          DBWR u...
DBWR dirty List MRU - Hot           Buffer Headers                       LRU - Cold DBWR also has to                    Di...
DBWR merges Dirty and Checkpoint MRU - Hot                Buffer Headers                         LRU - Cold             Ch...
log file switch (private strand flush incomplete) New wait 10g Like a “log file switch Completion”                      ...
Redo Wait Solutionslog file sync   Commit less, put redo logs on faster diskslog buffer space   Increase log buffer no mor...
Upcoming SlideShare
Loading in …5
×

Oracle 10g Performance: chapter 08 redo

1,028 views

Published on

Published in: Education
  • Be the first to comment

Oracle 10g Performance: chapter 08 redo

  1. 1. Redo Waits Kyle Haileyhttp://perfvision.com/ftp/emea2010 Kyle.hailey@embarcadero.com #.1
  2. 2. In This Section:1. Log Buffer Space2. Log File Sync3. Log File Switch Completion4. Log File Switch (checkpoint incomplete)5. Log File Switch (private strand flush incomplete)6. Log File Switch (archiving needed)7. Switch Log File Command Copyright 2006 Kyle Hailey #.2
  3. 3. Log File Waits SGA Log Library Buffer Buffer Cache Cache Buffer Cache Log Buffer DBWRLGWR User1 User2 User3 REDO Log Files Data Files Copyright 2006 Kyle Hailey #.3
  4. 4. Log File Operations Redo is written to disk when  User commits  Log Buffer 1/3 full (_log_io_size)  Log Buffer fills 1M  Every 3 seconds  DBWR asks LGWR to flush redo Sessions Commiting wait for LGWR Copyright 2006 Kyle Hailey #.4
  5. 5. log buffer space Wait for space in the redo log buffer in SGA Solution 1. Increase log_buffer parameter in init.ora  Above 3M log_buffer little affect, if still a problem then backup is at disk level 1. Improve disk IO for redo  Faster disk  Raw file  Direct IO  Dedicated disk p1, p2, p3 – no values Copyright 2006 Kyle Hailey #.5
  6. 6. Log Buffer Space SGA Log Library Buffer Buffer Cache Cache Buffer Cache Log Buffer LGWR User1 1. Log Buffer too small User2 2. LGWR too slow User3  Slow disk Insert UpdateREDO Log Files delete #.6 Copyright 2006 Kyle Hailey
  7. 7. log file sync Wait for redo flush upon:  Commit  Rollback Arguments  P1 = buffer# in log buffer that needs to be flushed  P2 = not used  P3 = not used select parameter1, parameter2, parameter3 from v$event_name where name=‘log file sync; PARAMETER1 PARAMETER2 PARAMETER3 buffer# Copyright 2006 Kyle Hailey #.7
  8. 8. Log File Sync SGA Log Library Buffer Buffer Cache Cache DBWR LGWR User1 User2 User3 Commit;REDO Log Files wait for LGWR Data Files Copyright 2006 Kyle Hailey #.8
  9. 9. Log File Sync: Solutions Commit less  Often possible in loops that commit every loop  Commit every 50 or 100 instead  Possibly 10gR2  ALTER SYSTEM SET COMMIT_WRITE = BATCH, NOWAIT  Commit could be lost if machine crash or IO error Improve IO  Use Raw Device or Direct IO  Consider Ram Disks  Can stripe if redo writes are comparable to stripe size  Striping shouldn’t hurt  Striping can help  Ex: imp – can have large redo writes – can improve by 10- 30% Alternate disks for redo and archiving of redo(_high_priority_processes) Copyright 2006 Kyle Hailey #.9
  10. 10. Log File Sync depends on: log file parallel write  Time it takes for LGWR to write out changes If log file sync =~ log file parallel write  And the time is slow ( > 3ms) look into IO issues If log file sync >> log file parallel write  Look at CPU starvation issues Copyright 2006 Kyle Hailey #.10
  11. 11. Separating LGWR and ARCH LGWR ARCH Redo 1 Redo 2 Redo 3 Redo 4 Copyright 2006 Kyle Hailey #.11
  12. 12. Log file switch completion No p1,p2,p3 Wait for lgwr to switch log files when generating redo Solution:  Increase redo log file size  Reduce frequency of switches Copyright 2006 Kyle Hailey #.12
  13. 13. log file switch completion Block xxxx SGA Block xxxxSessions Log Library Buffer Block xxxx Block xxxxwriting redo Buffer Cache Cache Buffer Cache Block xxxxwait while Block xxxxswitch happens Log Buffer Block xxxx Block xxxx DBWR LGWR User3 User2 User1 Commit;1 2 3 Wait for REDO Log Files LGWR Data FilesWait : log file switch completion Copyright 2006 Kyle Hailey #.13
  14. 14. log file switch (checkpoint incomplete)  No p1,p2,p3 args  Wait for checkpoint to complete because all log files are full  Solutions  Increase size of log files Copyright 2006 Kyle Hailey #.14
  15. 15. log file switch (checkpoint incomplete) : DiagSessions SGA Checkpoint 1 1writing redo Log Library Buffer Block xxxxwait while Checkpoint 2 Block xxxx 2 Buffer Cache Cache Buffer Cache Block xxxx xxxx Blockswitch AND BlockCheckpoint 3 Block xxxx xxxx 3checkpoint Log Buffer Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxxhappen Block xxxx Block xxxx Block xxxx DBWR Block xxxx Block xxxx Block xxxx LGWR BlockBlock xxxx xxxx BlockBlock xxxx xxxx User3 Block xxxx Block xxxx User2 User1 Commit; 3 Wait for REDO Log Files LGWR Data Files Copyright 2006 Kyle Hailey #.15
  16. 16. log file switch (archiving needed) No p1,p2,p3 Database “hangs” for transactions archive log stop; -- make room in log_archive_dest archive log start; Copyright 2006 Kyle Hailey #.16
  17. 17. log file switch (archiving needed) : SGA Log Library Buffer Buffer Cache Cache Buffer Cache Log Buffer LGWR ARCH 3 REDO Log Files Archive Dest Copyright 2006 Kyle Hailey #.17
  18. 18. switch logfile command Same as log file switch completion but the command is executed by the dba  Alter system switch logfile; Copyright 2006 Kyle Hailey #.18
  19. 19. Concerns – Recovery Time What happens to recovery time if I change my redo log file sizes Larger Redo Log size can increase recovery time but There are init.ora parameters to limit this Copyright 2006 Kyle Hailey #.19
  20. 20. Incremental Checkpoints (9iR2+)  FAST_START_MTTR_TARGET  Seconds to Recovery  Easy and accuracy  Is overridden by FAST_START_IO_TARGET  Is overridden by LOG_CHECKPOINT_INTERVAL alter system set fast_start_mttr_target=17 scope=both; SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; ESTIMATED_MTTR ESTIMATED_MTTR -------------- -------------- 21 21 Copyright 2006 Kyle Hailey #.20
  21. 21. Recovery and Checkpoints SGA Log Library Buffer DBWR Buffer Cache Cache LGWR Data Files Current Position Needed for Recovery1 2 3 Incremental Checkpoint REDO Log Files Copyright 2006 Kyle Hailey #.21
  22. 22. DBWR dirty List and LGWR Buffers DBWR usually just writes out LGWR Current dirty blocks at Position end of LRU until checkpoint Incremental Checkpoint DBWR Checkpoint aNow, DBWR Block xxxxkeeps a Block xxxxcheckpoint list that Block xxxx Block xxxxit writes out Copyright 2006 Kyle Hailey #.22
  23. 23. DBWR dirty List MRU - Hot Buffer Headers LRU - Cold DBWR also has to Dirty List track dirty blocks at the Block xxxx cold end of the LRU Block xxxx Block xxxx DBWR Block xxxx Copyright 2006 Kyle Hailey #.23
  24. 24. DBWR merges Dirty and Checkpoint MRU - Hot Buffer Headers LRU - Cold Checkpoint a Dirty List Block xxxx Block xxxx Block xxxx Block xxxx DBWR Block xxxx Block xxxx Block xxxx Block xxxx Write List Block xxxx Block xxxx Block xxxx Block xxxx Data Files Copyright 2006 Kyle Hailey #.24
  25. 25. log file switch (private strand flush incomplete) New wait 10g Like a “log file switch Completion” Copyright 2006 Kyle Hailey #.25
  26. 26. Redo Wait Solutionslog file sync Commit less, put redo logs on faster diskslog buffer space Increase log buffer no more than 32M, then tune LGWRlog file switch completion Increase log file sizeslog file switch (checkpoint incomplete) Add log files (or increase log file size)switch logfile command Avoid switching log files log file switch (private strand flush incomplete) increase log file sizeslog file switch (archiving needed) *** Archive log running out of space Copyright 2006 Kyle Hailey #.26

×