checkpoint and redo log files [message #322836] |
Mon, 26 May 2008 06:49 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
One doubt regarding recovery.
As is said checkpoint reduces crash recovery.
Reason: the more data in the datafiles the less data to recover.
But during recovery,Its the redo that is applied.During checkpoint its the datafiles that is written.
A checkpoint also updates the headers of datafiles and control files.
During recovery,oracle consults control files to see whats the latest checkpoint SCN.Then redo is applied upto that SCN.
Does CKPT also writes SCN info to redo log files?
Otherweise from where does oracle know where to start and where to end in the redo log files?
|
|
|
|
|
|
|
|
|
|
Re: checkpoint and redo log files [message #322888 is a reply to message #322836] |
Mon, 26 May 2008 11:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
So Checkpoint has nothing to do with redo log files.
Am i correct?
What I am unable to relate to is how checkpoint reduces crash recovery?
All a checkpoint does is flush dirty buffers to datafiles.
Oracle promises to have data buffer as free as possible so it has incremental checkpoints.
But since a crash recovery requires applying of redo,how would checkpoint tells oracle to apply how much redo?
What is the relationship between checkpoint and redo log files?
|
|
|
|
Re: checkpoint and redo log files [message #322893 is a reply to message #322836] |
Mon, 26 May 2008 12:18 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
"DBWn periodically writes buffers to advance the checkpoint, which is the position in the redo thread (log) from which instance recovery begins."
This log position is determined by the oldest dirty buffer in the buffer cache."
Very confusing documentation.Oracle has put very little effort to explain complex topics.This is what i don't like about oracle docs.
DBWn writing to datafiles,CKPT updating the headers of datafiles and controlfiles with same checkpoint SCN.This SCN is the position in the redo thread where recovery should begin.
So during recovery,oracle consults control file to see what is the latest checkpoint SCN.Then this SCN values is searched in the redolog files.WHen oracle finds the SCN in redo log files,it applies the redo starting from that SCN till the end of the redo log file.
I suppose the SCN in redo is the SCN that is marked with every change vector in the redo log buffer as Michel said earlier in the post.
So the greater the SCN, the lesser the redo.
Is my understanding right?
Do you guys know any article which has explained datafile checkpoint SCN,redo log file SCN concepts in detail?
EDIT:The same link tells so little about checkpoint
Checkpoint Process (CKPT)
"When a checkpoint occurs, Oracle must update the headers of all datafiles to record the details of the checkpoint. This is done by the CKPT process. The CKPT process does not write blocks to disk; DBWn always performs that work.
The statistic DBWR checkpoints displayed by the System_Statistics monitor in Enterprise Manager indicates the number of checkpoint requests completed."
No mention of control file updation during checkpoint.
[Updated on: Mon, 26 May 2008 12:22] Report message to a moderator
|
|
|
|
Re: checkpoint and redo log files [message #322981 is a reply to message #322836] |
Tue, 27 May 2008 00:14 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
Michel,I know its CKPT that marks checkpoint SCN in datafile headers and controlfiles.
Quote: | The most important to know is that in the control file you have:
- the current scn
- the checkpoint scn
- the log history with their first change (scn) in them.
Then to recover Oracle just have to check in which log is the checkpoint scn to start with.
|
Some more questions if you don't mind:
1) Control files contain the current SCN.
What does this current SCN represent?
2)Control files contain the checkpoint SCN.
This is the SCN that was marked in the datafile headers and control files.This SCN i suppose should be the same for datafiles and controlfiles at any checkpoint.
3)CF contains the log history with their first change SCN in them.
ie it records the SCN for every change vector present in redo log buffer.
Now you said
Quote: | Then to recover Oracle just have to check in which log is the checkpoint scn to start with.
|
The log only has the SCN for every change.
Where/When/How does it contain checkpoint SCN?
Thanks for being so patient.
This is what I am unable to get.
|
|
|
Re: checkpoint and redo log files [message #323006 is a reply to message #322981] |
Tue, 27 May 2008 01:01 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68675 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Quote: | 1) Control files contain the current SCN.
What does this current SCN represent?
|
The last change number.
Quote: | 2)Control files contain the checkpoint SCN.
This is the SCN that was marked in the datafile headers and control files.This SCN i suppose should be the same for datafiles and controlfiles at any checkpoint.
|
Yes, it should be.
Quote: | 3)CF contains the log history with their first change SCN in them.
ie it records the SCN for every change vector present in redo log buffer.
|
No it records the first scn in each log:
SQL> select thread#, sequence#, first_change# from v$log_history where rownum < 5;
THREAD# SEQUENCE# FIRST_CHANGE#
---------- ---------- -------------
1 531 3822594
1 532 3823308
1 533 3833005
1 534 3841519
Quote: | The log only has the SCN for every change.
Where/When/How does it contain checkpoint SCN?
|
It does not contain, it does not need to contain it.
I (Oracle) want to recover the database, I check database section in control file to get the checkpoint scn, then I check the entries in log history section of control file to know which log file contains the same scn value comparing the first change number for each entry with this value, then I start recover from this log.
Regards
Michel
|
|
|
|
|
Re: checkpoint and redo log files [message #323047 is a reply to message #322836] |
Tue, 27 May 2008 03:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
Yes very well described.
This is clearing a lots of concepts.
SO to end the topic,there is no relationship between checkpoint,CKPT and redo log files.
Checkpoint SCN is different from SCN marked in redolog buffer,though the values of SCN might be same but conceptually they are different.
|
|
|
Re: checkpoint and redo log files [message #323057 is a reply to message #323047] |
Tue, 27 May 2008 03:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68675 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Checkpoint SCN is just a value meaningful for Oracle (to recover) but not for users like your birth day is just a day in the year, meaningful for you (to compute your age) but not for others.
Regards
Michel
|
|
|