Home » RDBMS Server » Server Administration » checkpoint and redo log files
checkpoint and redo log files [message #322836] Mon, 26 May 2008 06:49 Go to next message
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 #322842 is a reply to message #322836] Mon, 26 May 2008 07:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
V$LOG_HISTORY (from control file) record first and next changes for each (archived) logs.
Each change vector is recorded with its SCN in redo logs.
So it easy for Oracle to know at which log file to start and then in this log file to find the first change vector after the last checkpoint (which is also in the control file).

Regards
Michel
Re: checkpoint and redo log files [message #322847 is a reply to message #322836] Mon, 26 May 2008 07:11 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
>>Each change vector is recorded with its SCN in redo logs.

when does this happen?
Re: checkpoint and redo log files [message #322850 is a reply to message #322847] Mon, 26 May 2008 07:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
When change vector is recorded in log buffer and then copied in log file.

Regards
Michel
Re: checkpoint and redo log files [message #322852 is a reply to message #322836] Mon, 26 May 2008 07:26 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
>>When change vector is recorded in log buffer and then copied in log file.

You mean at commit?
Re: checkpoint and redo log files [message #322856 is a reply to message #322852] Mon, 26 May 2008 07:49 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No, at each change.

Regards
Michel
Re: checkpoint and redo log files [message #322862 is a reply to message #322836] Mon, 26 May 2008 08:12 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
What marks that SCN in the redo log files?
Re: checkpoint and redo log files [message #322882 is a reply to message #322862] Mon, 26 May 2008 10:24 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The time (SCN) of the change.
What can I say?

When you walk you can record at which time you make each step. This recorded time is the time of your step. It does not mark anything, it is just its time.

Regards
Michel
Re: checkpoint and redo log files [message #322888 is a reply to message #322836] Mon, 26 May 2008 11:39 Go to previous messageGo to next message
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 #322889 is a reply to message #322836] Mon, 26 May 2008 11:48 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
from http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/process.htm#sthref1519

"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."

[Updated on: Mon, 26 May 2008 11:49] by Moderator

Report message to a moderator

Re: checkpoint and redo log files [message #322893 is a reply to message #322836] Mon, 26 May 2008 12:18 Go to previous messageGo to next message
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 #322954 is a reply to message #322893] Mon, 26 May 2008 23:16 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Is it important to know if it DBWR or CKPT that write the checkpoint SCN in the control files?
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.

Regards
Michel
Re: checkpoint and redo log files [message #322981 is a reply to message #322836] Tue, 27 May 2008 00:14 Go to previous messageGo to next message
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 messageGo to next message
Michel Cadot
Messages: 64103
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 #323021 is a reply to message #322836] Tue, 27 May 2008 01:55 Go to previous messageGo to next message
varu123
Messages: 754
Registered: October 2007
Senior Member
This is waht i also think.
There is checkpoint SCN in the control files.
There is system change nunber in the redologfiles.
During recovery,oracle checks the latest checkpoint SCN in the control file and searches in the redo log files to find the same SCN.

Checkpoint event ensures that the SCN that control file is looking for in the redolog files is found at RBA where minimum redo is applied.
SO it is wrong to say
"the informaiton of the SCN is maintained in the redo log file by CKPT."
Please give feedback for the above.

Also
I googled and found this so called book
http://books.google.co.in/books?id=xxx0KAwY_ZMC&pg=PA108&lpg=PA108&dq=checkpoint+information+in+control+files&source= web&ots=4DjkBEnX2u&sig=7uv8abLtf36VwAgjfqy_F4f2tF8&hl=en#PPA116,M1

Michel, i request you to look at page 116 under the heading checkpoint.What a complete load of garbage it says.
Re: checkpoint and redo log files [message #323043 is a reply to message #323021] Tue, 27 May 2008 03:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
SO it is wrong to say
"the informaiton of the SCN is maintained in the redo log file by CKPT."

Yes, it is right to say it is wrong.
CKPT never writes into log file.

I don't know anything about a "checkpoint record".
I don't see any use of it.
In addition, I don't see how it could work if DBWR writes a record in log buffer.
Assume LGWR needs to flush log buffer, you are at log switch and DBWR does not finish the previous checkpoint on the log file LGWR wants to get, so LGWR waits for DBWR to finish, but as log buffer is full DBWR can't write this "checkpoint record" until LGWR flushes the log buffer into log file and so wait for LGWR... So DBWR waits for LGWR which waits for DBWR. Deadlock.
Once again I can't see what could be the use of this "checkpoint record".

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 messageGo to next message
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
Michel Cadot
Messages: 64103
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
Previous Topic: Mirroring An Oracle Schema
Next Topic: Configuring a new Solaris server for Oracle 10g
Goto Forum:
  


Current Time: Sat Dec 03 22:00:05 CST 2016

Total time taken to generate the page: 0.11847 seconds