Presentation is loading. Please wait.

Presentation is loading. Please wait.

Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.

Similar presentations


Presentation on theme: "Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O."— Presentation transcript:

1 Redo Waits Kyle Hailey Kyle.hailey@hotmail.com

2 #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O

3 #.3 Copyright 2006 Kyle Hailey In This Section: 1.Log Buffer Space 2.Log File Sync 3.Log File Switch Completion 4.Log File Switch (checkpoint incomplete) 5.Log File Switch (private strand flush incomplete) 6.Log File Switch (archiving needed) 7.Switch Log File Command

4 #.4 Copyright 2006 Kyle Hailey Log File Waits REDO Log Files Data Files DBWR LGWR User2 User1 User3 Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache

5 #.5 Copyright 2006 Kyle Hailey 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

6 #.6 Copyright 2006 Kyle Hailey 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 2. Improve disk IO for redo  Faster disk  Raw file  Direct IO  Dedicated disk  p1, p2, p3 – no values

7 #.7 Copyright 2006 Kyle Hailey Log Buffer Space REDO Log Files Log Buffer LGWR Buffer Cache User2 User1 User3 InsertUpdatedelete Log Buffer Buffer Cache SGA Library Cache 1.Log Buffer too small 2.LGWR too slow Disk problemDisk problem

8 #.8 Copyright 2006 Kyle Hailey 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#

9 #.9 Copyright 2006 Kyle Hailey Log File Sync REDO Log Files Data Files DBWR LGWR User2 User1 User3 Commit; wait for LGWR Log Buffer Buffer Cache SGA Library Cache

10 #.10 Copyright 2006 Kyle Hailey Log File Sync: Solutions  Commit less  Often possible in PL/SQL loops that commit every loop  Commit every 50 or 100 instead  Put redo on dedicated disk  Use Raw Device or Direct IO  More Radical  Consider Ram Disks  Can stripe if redo writes are comparable to stripe size  Striping shouldn’t heard  Striping can help  Ex: imp – can have large redo writes – can improve by 10- 30%  Alternate disks for redo and archiving of redo  Possibly 10gR2  ALTER SYSTEM SET COMMIT_WRITE = BATCH, NOWAIT  Commit could be lost if machine crash  Or IO error

11 #.11 Copyright 2006 Kyle Hailey Separating LGWR and ARCH Redo 1 Redo 3 Redo 2 Redo 4 LGWR ARCH

12 #.12 Copyright 2006 Kyle Hailey 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

13 #.13 Copyright 2006 Kyle Hailey Log File Switch completion Log File Switch steps A lot of activity:  Get next log file from control file  Get Redo Copy and Redo Allocation latch  Flush redo  Close File  Update Controlfile  Set new file to Current  Set old file to Active  If in Archivelog mode add file to archive list  Open all members of new logfile group  Write the SCN to the headers  Enable redo log generation DBWR makes a list of blocks that need to be written out in order to over write the Redo log file a list of blocks that need to be written out in order to over write the Redo log file

14 #.14 Copyright 2006 Kyle Hailey log file switch completion REDO Log Files Data Files Log Buffer DBWR LGWR Buffer Cache Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Wait : log file switch completion User2 User1 User3 User2 User1 User3 Commit; Wait for LGWR Log Buffer Buffer Cache SGA Library Cache 1 2 3 1 Sessions writing redo wait while switch happens

15 #.15 Copyright 2006 Kyle Hailey log file switch (checkpoint incomplete)  No p1,p2,p3 args  Wait for checkpoint to complete because all log files are full  Solutions  Add more log files  Increase size of log files

16 #.16 Copyright 2006 Kyle Hailey log file switch (checkpoint incomplete) : Diag REDO Log Files Data Files Log Buffer LGWR Buffer Cache User2 User1 User3 Commit; Wait for LGWR Checkpoint 1 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Checkpoint 2 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Checkpoint 3 Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx Block xxxx DBWR Log Buffer Buffer Cache SGA Library Cache 1 2 3 3 Sessions writing redo wait while switch happens And checkpoint happen

17 #.17 Copyright 2006 Kyle Hailey 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;

18 #.18 Copyright 2006 Kyle Hailey log file switch (archiving needed) : Diag REDO Log Files Archive Dest ARCH LGWR User 2 User 1 User 3 Commit; Wait for LGWR Log Buffer Buffer Cache Log Buffer Buffer Cache Log Buffer Buffer Cache SGA Library Cache 3

19 #.19 Copyright 2006 Kyle Hailey switch logfile command  Same as log file switch completion but the command is executed by the dba  Alter system switch logfile;

20 #.20 Copyright 2006 Kyle Hailey 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  Standby DB: ARCHIVE_LAG_TARGET  Seconds, limits lag between primary and standby  Increases log file switches

21 #.21 Copyright 2006 Kyle Hailey 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 SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; ESTIMATED_MTTR -------------- 21 SQL> select ESTIMATED_MTTR from V$INSTANCE_RECOVERY; ESTIMATED_MTTR -------------- 21 alter system set fast_start_mttr_target=17 scope=both;

22 #.22 Copyright 2006 Kyle Hailey Recovery and Checkpoints REDO Log Files Data Files DBWR LGWR Log Buffer Buffer Cache SGA Library Cache Incremental Checkpoint Current Position Needed for Recovery 1 2 3

23 #.23 Copyright 2006 Kyle Hailey DBWR dirty List and LGWR Buffers Checkpoint a Block xxxx Block xxxx Block xxxx Block xxxx LGWR DBWR Current Position Incremental Checkpoint DBWR DBWR usually just writes out dirty blocks at end of LRU until checkpoint Now, DBWR keeps a checkpoint list That it cleans a

24 #.24 Copyright 2006 Kyle Hailey DBWR dirty List MRU - Hot LRU - Cold Buffer Headers Dirty List Block xxxx Block xxxx Block xxxx Block xxxx DBWR DBWR also has to track dirty blocks at the cold end of the LRU

25 #.25 Copyright 2006 Kyle Hailey DBWR merges Dirty and Checkpoint MRU - Hot LRU - Cold Buffer Headers Dirty List Block xxxx Block xxxx Block xxxx Block xxxx DBWR Checkpoint a Block xxxx Block xxxx Block xxxx Block xxxx Write List Block xxxx Block xxxx Block xxxx Block xxxx Data Files There are 2 checkpoint lists One the DBWR can write to disk While users can disk While users can concurrently update the other

26 #.26 Copyright 2006 Kyle Hailey log file switch (private strand flush incomplete)  New wait 10g  Like a “log file switch Completion”

27 #.27 Copyright 2006 Kyle Hailey Redo Wait Solutions 2 log file sync Commit less, put redo logs on faster disks 11 log buffer space Increase log buffer no more than 32M, then tune LGWR 12 log file switch completion Increase log file sizes 22 log file switch (checkpoint incomplete) Add log files (or increase log file size) 30 switch logfile command Avoid switching log files 32 log file switch (archiving needed) *** Archive log running out of space


Download ppt "Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O."

Similar presentations


Ads by Google