Generation of redo log file [message #472472] |
Fri, 20 August 2010 16:51 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
muktha_22
Messages: 527 Registered: December 2009
|
Senior Member |
|
|
Hi,
I'm just confused about the redo generation. As I found the below statement in another forum.
"Undo segment generates the redo data also, because undo segment is database changes, so it generates the redo data also."
How a Undo segment can generate Redo and Undo datas.
Thanks in advance
|
|
|
|
|
Re: Generation of redo log file [message #473222 is a reply to message #472487] |
Thu, 26 August 2010 14:25 ![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) |
muktha_22
Messages: 527 Registered: December 2009
|
Senior Member |
|
|
Hi Mickel,
Yes I understood, but I need more clarification.
please don't tell me to read any documents, as I did many and still have some doubts.
please pinpoint me where I'm wrong.
Eg: update <table name> set salary=50000 where name ='mutu';
1) Now the Undo Data Goes to the Undo segment of a undo Tablespace or system tablespace.
2) And the Redo data Goes to the Redo log buffer (hope it will not go to the data buffer cache).
3) From the Redo log buffer, the Redo data gets placed into the online redo log buffer when CKPT occur.
4) if any instance failure happens, then the Undo Data from the Undo segment will be rollforword to the data buffer cache.
5) then it takes the place into the original datablock.
6) Now Redo data will be rolled back from the online redo. And where it goes then?
7) When and how Redo data hold all the modified data as you mentioned above previous post?
Thanks in advance.
|
|
|
Re: Generation of redo log file [message #473225 is a reply to message #473222] |
Thu, 26 August 2010 14:53 ![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) Now the Undo Data Goes to the Undo segment of a undo Tablespace or system tablespace.
No, it is still in buffer.
Quote:2) And the Redo data Goes to the Redo log buffer (hope it will not go to the data buffer cache).
Yes, redo data to generate new data as well as undo data.
Quote:3) From the Redo log buffer, the Redo data gets placed into the online redo log buffer when CKPT occur.
Or some other events.
Quote:4) if any instance failure happens, then the Undo Data from the Undo segment will be rollforword to the data buffer cache.
No, rollforward applies to file not to cache. But "rollforwarded" undo blocks are surely then in cache.
Quote:5) then it takes the place into the original datablock.
No, first data file blocks are rolled forward to the new value, if it does not contain it yet.
Quote:6) Now Redo data will be rolled back from the online redo. And where it goes then?
No, there are NEVER modification in redo logs.
At this point, data block is rolled back using undo forwarded block because Oracle does not find a commit marker for the transaction containing the update.
Quote:7) When and how Redo data hold all the modified data as you mentioned above previous post?
Redo buffer during update, redo file after flush of redo buffer.
I re-read your first post:
Quote:As I found the below statement in another forum.
"Undo segment generates the redo data also, because undo segment is database changes, so it generates the redo data also."
It was not in another forum, it is in this one and it was one of my answers. ![Smile](images/smiley_icons/icon_smile.gif)
Regards
Michel
[Updated on: Thu, 26 August 2010 14:55] Report message to a moderator
|
|
|
Re: Generation of redo log file [message #473306 is a reply to message #473225] |
Fri, 27 August 2010 06:06 ![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) |
muktha_22
Messages: 527 Registered: December 2009
|
Senior Member |
|
|
Hi Mickel,
1) Which means uncommitted data from online redo log files will not rollback?
2) If the Undo Data stored in data buffer cache, then what is the use of Undo segment in the tablespace?
3) can we see the particular undo Data from the buffer cache?
Thanks
|
|
|
|
Re: Generation of redo log file [message #473428 is a reply to message #473306] |
Sat, 28 August 2010 04:11 ![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) |
Yasir Hashmi
Messages: 304 Registered: April 2006
|
Senior Member |
|
|
Hi,
There are two things you are confusing with
1)Read consistency
2)Recovery
The sheer purpose of undo is to provide read consistency.
When you update
update <table name> set salary=50000 where name ='mutu';
The previous value is loaded in the undo segment.Now when any other session query the table,it sees the old image from undo segment to mainitain read consistency.Oracle never allows uncommitted data to be seen in the query.
How a Undo segment can generate Redo and Undo datas.
Any change whatsoever in the database generate redo.
When you changed salary to 50000 say from 40000,that 40000 is logged in the undo segment which is a change in the undo segment hence both 40000 and 50000 are logged in the redo log files.
Now if instance crashed,oracle starts with the rolforward,roll forward every committed data and rollbacks any uncommiited data.
If you did not commit, then oracle sees that 50000 as uncommitted and rolls it back.
|
|
|
Re: Generation of redo log file [message #473430 is a reply to message #473428] |
Sat, 28 August 2010 04:31 ![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:The sheer purpose of undo is to provide read consistency.
No, its purpose is to guarantee transaction rules against failure, so it is recovery.
Read consistency is a (very welcome) side effect of its implementation.
Quote:ow when any other session query the table,it sees the old image from undo segment to mainitain read consistency.
Not really, as I previously said, undo data are (or rather may be) used to reconstruct data as they were at the beginning of the statement.
Quote:Any change whatsoever in the database generate redo.
Correct.
Quote:When you changed salary to 50000 say from 40000,that 40000 is logged in the undo segment which is a change in the undo segment hence both 40000 and 50000 are logged in the redo log files.
Correct but I'm not sure you really understand how they are.
Quote:Now if instance crashed,oracle starts with the rolforward
Correct.
Quote:roll forward every committed data and rollbacks any uncommiited data
No, roll forward every modification, then rolls back uncommited ones.
Regards
Michel
|
|
|
Re: Generation of redo log file [message #473434 is a reply to message #473430] |
Sat, 28 August 2010 05:03 ![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) |
Yasir Hashmi
Messages: 304 Registered: April 2006
|
Senior Member |
|
|
No, its purpose is to guarantee transaction rules against failure, so it is recovery.
And what kind of rules? Redo and Undo are two different structures.If undo is for recovery what is redo for?
Correct but I'm not sure you really understand how they are .
Kindly explain Michel.
As i understand, when we modify any data say 40 to 50,that 50 is the change for data block and 40 is teh change for undo block, so both the are recorded in redo.
No, roll forward every modification, then rolls back uncommited ones.
yes,rollforward every modification.
|
|
|
|
Re: Generation of redo log file [message #473442 is a reply to message #473436] |
Sat, 28 August 2010 06:12 ![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) |
Yasir Hashmi
Messages: 304 Registered: April 2006
|
Senior Member |
|
|
I quoted your entire text
Michel,
Isolation =>undo
Duration=>redo
This is ACID.
When is undo used for recovery.
If you mean transaction recovery,then that is not recovery in strict sense. Recovery is making database consistent which is done by redo[SAME SCN upon instance startup]
|
|
|
Re: Generation of redo log file [message #473458 is a reply to message #473442] |
Sat, 28 August 2010 07:59 ![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 |
|
|
Quote:When is undo used for recovery
Well, I use "redo" in a large meaning, when I said "it is for recovery", I should say "it is for something like statement recovery" (in the opposite of OP's "it is for read consistency"), I didn't want to say it is STRICTLY for instance recovery.
The FIRST purpose of undo is not ISOLATION but ATOMICITY that is rollback/undo of a transaction (or in the large meaning I posted "recovery" of the previous values).
ISOLATION (and here READ CONSISTENCY) is a side effect of this ATOMICITY implementation using UNDO/ROLLBACK segments that avoid Oracle to develop something else to guarantee it (like READ or ROW SHARE locks in other RDBMS).
Quote:Recovery is making database consistent which is done by redo
And UNDO. The first step is to roll forward using REDO, the second step is to roll back using UNDO.
Quote:[SAME SCN upon instance startup]
Same SCN of what?
Regards
Michel
|
|
|