Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Praveen.

Asked: January 25, 2005 - 11:57 am UTC

Last updated: January 26, 2005 - 9:25 am UTC

Version: 817

Viewed 1000+ times

You Asked

I have read your replies in this regard, but am unable to satisfy one of my queries. Let me try to put it in a simple way:

Let's say we have started a transaction:
1. During the course of transction, the data blocks in buffer cache get modified - dirty.
2. The transaction has NOT been committed till now.
3.After some time the DBWR writes the modified blocks to disk. So the original data in the respective blocks are no more available.
4.At this instance the database crashes.
5. Please note that we have not committed our transaction at all.

As far as i could understand, the roll-back segments hold undo data, and redo-logs contain data so as to redo a transaction.

But since in this case, the instance has crashed, anything held in the rollback segments in no more available. And since the redo-logs do not store the initial image of the blocks, i.e. before the transaction started, i fail to understand, how will we be able to get the prior image of the block, i.e. before transaction started.

That brings me to my question - What exactly goes into the redo-log files?

From whatever i could search on net, they only talk about change information to redo a transaction.

But if we are to restore the original block image, we also need to capture the image of the block (w.r.t modified data) before the start of the transction to handle this kind of eventuality.

Please throw some light on this. We are thankful to you in making us understand Oracle better.

Regards,

Praveen Kumar

and Tom said...

<quote>
anything held in the rollback
segments in no more available.
</quote>

where did you get that impression? lose it -- it is very very very wrong.


rollback is protected by redo, data is protected by redo. What happens upon instance recovery would be:

a) redo is applied catching ALL SEGMENTS (and redo is a segment) except for temporary ones up to the point in time just immediately prior to the crash

b) after that is done, all transactions that had not yet committed at the time of the crash are rolled back.

rollback is definitely protected by redo.
rollback must be backed up
rollback is recovered and totally available during instance recovery.

If you have access to "Expert one on one Oracle" -- I cover this in lots more detail.

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanks a ton.

Praveen Kumar, January 25, 2005 - 3:44 pm UTC

I am satisfied by the answer and also impressed by the clarity and promptness of the reply.

No wonder we jump to you whenever we are in doubt. Thanks again.

Typo

Jon, January 26, 2005 - 12:39 am UTC

I think you might have a slight typo:

a) redo is applied catching ALL SEGMENTS (and redo is a segment)

should read:

a) redo is applied catching ALL SEGMENTS (and rollback is a segment)

correct?

Tom Kyte
January 26, 2005 - 8:42 am UTC

yes, thanks -- i had redo on the brain :)

Confused

A reader, January 26, 2005 - 9:05 am UTC

The original poster said..

"3.After some time the DBWR writes the modified blocks to disk. So the original
data in the respective blocks are no more available."

Wouldn't DBWR *waits* till the data is commited, so it can write the dirty buffers to disk successfully ?

Tom Kyte
January 26, 2005 - 9:25 am UTC

no, dbwr is not obligated to wait, and many times dbwr HAS to checkpoint blocks to disk that have been modified but not yet committed.


for example, I've posted demos where I update gigabytes of information, using a 64meg buffer cache.

It would not all fit in ram at the same time.

for previous poster...

Connor, January 26, 2005 - 9:20 am UTC

dbwr may need to write out dirty buffers before commit - if space is needed in the cache for incoming buffers.

More to Explore

Backup/Recovery

Check out the complete guide to all of the Backup & Recovery techniques in the Oracle Database.