Home » SQL & PL/SQL » SQL & PL/SQL » why oracle writes first redolog after commit was issued?
why oracle writes first redolog after commit was issued? [message #258725] Mon, 13 August 2007 08:17 Go to next message
prakash415
Messages: 4
Registered: June 2007
Location: chennai
Junior Member

hi all,
Why does Oracle write into Redo logs first before writing into Datafiles after a commit is issued? Please explain your answer.
Re: why oracle writes first redolog after commit was issued? [message #258728 is a reply to message #258725] Mon, 13 August 2007 08:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Oracle does not write into logs after commit, it writes into logs every time there is a modification.
And this protects against failure.
Data in datafiles are not important as they can be reconstruct with logs.

Regards
Michel
Re: why oracle writes first redolog after commit was issued? [message #258748 is a reply to message #258728] Mon, 13 August 2007 09:09 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Quote:
Oracle does not write into logs after commit,


Sorry Michel, I need to disagree there. From Documentation
Quote:
Whenever a
transaction is committed, LGWR writes the transaction redo records from the redo log
buffer of the SGA to a redo log file, and assigns a system change number (SCN) to
identify the redo records for each committed transaction. Only when all redo records
associated with a given transaction are safely on disk in the online logs is the user
process notified that the transaction has been committed.

However I have a feeling that that is not actually what you are trying to say.
I believe that what you mean is that Oracle doesn't just write to the redo logs after commit, ... Actually no, just re-read your message again, you appear to be referring to the redo log buffer, I think that the OP is actually talking about the Online Redo Log Files. (Or do you know that and are just trying to make a point?)
Re: why oracle writes first redolog after commit was issued? [message #258751 is a reply to message #258748] Mon, 13 August 2007 09:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Oracle does not write into logs after commit,


Sorry Michel, I need to disagree there. From Documentatio[/QUOTE]
You cut my sentence, this is very very bad. Wink
I added:
Quote:
it writes into logs every time there is a modification.

Maybe I should say:
Oracle does not write into logs ONLY after commit.
Quote:
However I have a feeling that that is not actually what you are trying to say.
I believe that what you mean is that Oracle doesn't just write to the redo logs after commit

OK, I now read the next part of your post, this is what I meant.
Quote:
you appear to be referring to the redo log buffer, I think that the OP is actually talking about the Online Redo Log Files.

Given the question, I don't think OP makes a difference between that and we can assume redo log buffer and redo log file are the same.

Actually there is no relation between when redo vectors are written into redo logs (files) and when modified data are written onto disks. It may be before or after.

Regards
Michel
Re: why oracle writes first redolog after commit was issued? [message #258756 is a reply to message #258751] Mon, 13 August 2007 09:29 Go to previous messageGo to next message
prakash415
Messages: 4
Registered: June 2007
Location: chennai
Junior Member

hello senior members,
I think, both of you were right... because after commit, the redo log buffer writes into redolog file and after all the logs are written and then it issues a command to database writer to write datafiles....sorry if it is wrong.. this was only taught to me when i studied..anyway i need more answers from you....
Re: why oracle writes first redolog after commit was issued? [message #258826 is a reply to message #258756] Mon, 13 August 2007 11:24 Go to previous message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Don't mind, we are agree it was just a matter of details.
You're when you issue a commit, Oracle tells log writer to write the log buffer to log file.

Log Writer does not awake Db Writer at commit time.

Regards
Michel
Previous Topic: in which way to tune my database
Next Topic: Diffference between two dates
Goto Forum:
  


Current Time: Sat Dec 07 06:36:44 CST 2024