Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Deferred Transaction Recoverability

Re: Deferred Transaction Recoverability

From: Nuno Souto <nsouto_at_optushome.com.au.nospam>
Date: Thu, 23 Aug 2001 16:07:51 GMT
Message-ID: <3b8521e1.18356745@news>


On Thu, 23 Aug 2001 22:48:44 +0800, Dino Hsu <dino1_at_ms1.hinet.net> wrote:

>it's gonna be in the test) The magic word 'parallel' can be
>accompanied with many things, such as 'query', 'server', 'DDL', 'DML',
>and now 'backup', 'rollback' and 'transaction recovery', and it always
>successfully causes me headaches. :(

:-)
Well, I'll let someone else reply to the first part. Let's talk a bit about the following:

>
>I am still confused by the relation between datafiles, logfiles, and
>rollback segments.

'sOK. It's not intuitive.

>First, since the before-image of data is stored in
>rollback segments (datafiles too), it's enough information for
>recovery, why bother inventing sth. called logfiles? Isn't it like
>riding a horse on a running car?

Before-images only last until the transaction is committed. Once that happens, they are (most of the time) dropped. Their purpose is to provide the ability to rollback the effects of a given transaction that has resulted in changes to data, should the transaction be aborted for whatever reason. IOW, they only "recover" a current pending transaction. They also are used to provide read-consistency, but let's not go there for the time being, that's got nothing to do with recovery.

Logfiles are used to recover from loss of datafiles. They allow you to recover the database to any time between the last backup and just before the event that caused the loss of datafile. They keep a log (hence the name) of every change made to the database, in a time-sequence and with all sorts of other information to allow transaction consistency and sequencing.

>Second, the 'roll-forward' process
>executes both the committed and uncommitted transactions on instance
>recovery, which, I assume, means to store data in datafiles according
>to the information provided by logfiles.

That is almost correct. They also check that the data is or is not aalready there. If it is there (the earlier asynchronous write succeeded before the crash), then they do nothing. Otherwise, they plonk in the data change that should have been there had the system not crashed.

>This is really wierd, aren't
>uncommitted transactions supposed to be rolled back on instance
>recovery because they are uncommitted when the previous instance
>failure happens?

Yes.

>Does it also mean that committed transactions can be
>recorded in logfiles but not yet stored in datafiles?

Precisely. The writing into datafiles of any change (including the writing on rollbacks of the undo information!) is asynchronous to the completion of a transaction. Ie, when the transaction finishes, the logfile WILL definitely have been written to disk, but the datafile and undo disk changes might not have finished yet. If the system crashes while this is pending, the startup recovery will first "roll-forward" (finish off) the writing of the rollback undo information, and *then* use that information to rollback incomplete transactions at the time of the crash.

>Third, what does
>it mean by 'defer'? What is 'deferred'? How can the instance recovery
>process be speeded up from it? Anyway, I wish the author could have
>explained in more details.
>

The term deferred here means just that transaction recovery (the rollback) may happen after the database has been "rolled-forward". It's just a word to label the process I just described above.

The quote you mentioned is slightly incorrect in that it appears to infer this is a behaviour of V8. It's been there since V6 or V7, can't remember exactly. What's new in V8 is the parallel (headache time again...) execution of this "roll-forward/rollback" process, to reduce the time it takes when there were a lot of things to flush out and rollback as a result of the crash.

There is more to it than just this, but it should get you started in the right direction.

Cheers
Nuno Souto
nsouto_at_optushome.com.au.nospam Received on Thu Aug 23 2001 - 11:07:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US