Home » RDBMS Server » Server Administration » Generation of redo log file (Oracle 9i.0.2, Windows. )
Generation of redo log file [message #472472] Fri, 20 August 2010 16:51 Go to next message
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 #472473 is a reply to message #472472] Fri, 20 August 2010 16:59 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/

It appears you need to wait for Michel to wake up & spoon feed you yet another Read The Fine Manual answer.
He'll be back online in 5 - 6 hours
Re: Generation of redo log file [message #472487 is a reply to message #472473] Sat, 21 August 2010 01:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As it is Saturday, I'm back after only 8 - 9 hours. Wink

Database Administrator's Guide
Chapter 6 Managing the Redo Log

Redo logs protects all database modifications against instance failure.
Each (user) data modification generates UNDO data.
These UNDO data are (system) data, so generate UNDO data is database modification and as such must be protected in the same way than user data modifications.
So UNDO data generation generates REDO.

Regards
Michel
Re: Generation of redo log file [message #473222 is a reply to message #472487] Thu, 26 August 2010 14:25 Go to previous messageGo to next message
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 messageGo to next message
Michel Cadot
Messages: 68653
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

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 messageGo to next message
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 #473361 is a reply to message #473306] Fri, 27 August 2010 09:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
1) Which means uncommitted data from online redo log files will not rollback?

This question is irrelevant. Redo logs are not part of transaction.

Quote:
2) If the Undo Data stored in data buffer cache, then what is the use of Undo segment in the tablespace?

Change "Undo" by "User" and you will see the answer.

Quote:
3) can we see the particular undo Data from the buffer cache?

Yes. And then?

Regards
Michel
Re: Generation of redo log file [message #473428 is a reply to message #473306] Sat, 28 August 2010 04:11 Go to previous messageGo to next message
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 messageGo to next message
Michel Cadot
Messages: 68653
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 messageGo to next message
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 #473436 is a reply to message #473434] Sat, 28 August 2010 05:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68653
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
And what kind of rules?

The ACID ones.

Quote:
If undo is for recovery what is redo for?

Recovery too, isn't it clear from has been said?

I don't really understand the last part of your post. The "No" you quoted is a "No" to OP asssertion not to mine.

Regards
Michel
Re: Generation of redo log file [message #473442 is a reply to message #473436] Sat, 28 August 2010 06:12 Go to previous messageGo to next message
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
Michel Cadot
Messages: 68653
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
Previous Topic: query required
Next Topic: PMON "failed to acquire latch" during shutdown
Goto Forum:
  


Current Time: Sun May 19 22:32:20 CDT 2024