Beruflich Dokumente
Kultur Dokumente
Kyle Hailey
Kyle.hailey@hotmail.com
#.2
Redo
Locks
Network
I/O
Copyright 2006
Kyle Hailey
#.3
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
Copyright 2006
Kyle Hailey
#.4
Log File Waits
SGA
Log Library Buffer
Buffer Cache Cache
Buffer Cache
Log Buffer
DBWR
LGWR
User1
User2
User3
Copyright 2006
Kyle Hailey
#.6
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
Copyright 2006
Kyle Hailey
Log Buffer Space
#.7
SGA
Log Library Buffer
Buffer Cache Cache
Buffer Cache
Log Buffer
LGWR
User1
1. Log Buffer too small
User2
2. LGWR too slow
User3 • Disk problem
Insert
Update
REDO Log Files delete
Copyright 2006
Kyle Hailey
#.8
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
Log File Sync #.9
SGA
Log Library Buffer
Buffer Cache Cache
DBWR
LGWR
User1
User2
User3
Commit;
REDO Log Files Data Files
wait for LGWR
Copyright 2006
Kyle Hailey
#.10
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
Copyright 2006
Kyle Hailey
#.11
LGWR ARCH
Redo 1 Redo 2
Redo 3
Redo 4
Copyright 2006
Kyle Hailey
#.12
Copyright 2006
Kyle Hailey
#.13
Copyright 2006
Kyle Hailey
#.14
log file switch completion 1
Block xxxx
SGA Block xxxx
Sessions Log Library Buffer Block xxxx
Block xxxx
writing redo Buffer Cache Cache
Buffer Cache Block xxxx
wait while Block xxxx
DBWR
LGWR
User2
User1
User3
Commit;
1 2 3 Wait for
REDO Log Files LGWR Data Files
Wait : log file switch completion
Copyright 2006
Kyle Hailey
#.15
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
Copyright 2006
Kyle Hailey
log file switch (checkpoint incomplete)#.16: D
Sessions SGA Checkpoint 1 1
writing redo Log Library Buffer Block xxxx
wait while
Checkpoint 2
Block xxxx 2
Buffer Cache Cache
Buffer Cache Block xxxx
Block xxxx
switch happens BlockCheckpoint
Block xxxx xxxx 3
3
Log Buffer BlockBlock
Block xxxx xxxx xxxx
And checkpoint BlockBlock
Block xxxx xxxx xxxx
BlockBlock
Block xxxx xxxx xxxx
happen DBWRBlockBlock
Block xxxx xxxx xxxx
LGWR BlockBlock
xxxx xxxx
BlockBlock
xxxx xxxx
Block xxxx
User2 Block xxxx
User1
User3
Commit;
3 Wait for
REDO Log Files LGWR Data Files
Copyright 2006
Kyle Hailey
#.17
Copyright 2006
Kyle Hailey
#.18
Copyright 2006
Kyle Hailey
#.19
Copyright 2006
Kyle Hailey
#.20
Copyright 2006
Kyle Hailey
#.21
Copyright 2006
Kyle Hailey
#.22
Recovery and Checkpoints
SGA
Log Library Buffer DBWR
Buffer Cache Cache
LGWR
Data Files
Current Position
DBWR usually
just writes out
Current Position LGWR dirty blocks at
end of LRU
until checkpoint
Incremental Checkpoint
DBWR
Checkpoint a
Now, DBWR Block xxxx
keeps a Block xxxx
checkpoint list Block xxxx
Block xxxx
That it cleans a
Copyright 2006
Kyle Hailey
#.24
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
Copyright 2006
Kyle Hailey
#.25
DBWR merges Dirty and
Checkpoint
MRU - Hot Buffer Headers LRU - Cold
Copyright 2006
Kyle Hailey
#.27
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
Copyright 2006
Kyle Hailey