Instance recovery behaviour
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 44

Thread: Instance recovery behaviour

  1. #1
    Join Date
    Feb 2001
    Location
    Scotland
    Posts
    200

    Instance recovery behaviour

    If the instance crashes whilst there are uncommitted changes in the
    datafiles then this is repaired during instance recovery during the rollback
    phase after the roll forward of all the changes in the online redologs. This
    is done by reading the redo logs to look for commits on all the rolled
    forward changes. But in NOARCHIVELOG mode commits for any changes that were
    in the datafile before the instance crash could have been recorded in the
    redologs that have been overwritten. How does SMON know what has been
    committed or not if the database is in NOARCHIVELOG mode?
    What's the sound of one hand clapping - "CL"

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    well instance recovery has got nothin to with mode of operation of the database wheather you are in archivelog mode or noarchive log mode instance recovery follows the same principles..they use the system Change Number as the basis for recovering commited transaction..


    regards
    Hrishy

  3. #3
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,448
    well not only redo is read during instance recovery, RBS are read as well

    imagine I have an uncommitted transaction in redo log 1 and I have 3 redo logs, this transaction is recorded in redo log 1, then several transactions are going on, checkpoints are occuring all the time so my uncommitted trsanction is flushed to disk as well since it's dirty block, my redo log 1 gets overwritten, in redo log 2 instance crashes

    then in instance recovery Oracle reads Redo logs and RBS and noticed I had an uncommitted transaction so it rolls back my transaction (and hey the redo has been overwritten), so no big deal

    what happens with committed transactions? well checkpoints ensure they are flushed to disk, checkpoint occurs all the time and during log switches as well so at the end of the day I only really have to read the last redo log to recover any committed changes and in instance recovery *most* of the time Oracle only reads the last redo log
    Last edited by pando; 03-03-2003 at 09:22 AM.

  4. #4
    Join Date
    Feb 2001
    Location
    Scotland
    Posts
    200
    I thought I understood all about this however, I've been asked a question and I'm having problems putting the answer into words.

    My database is working normally, the logs are switching and I am doing full Checkpoint events at every log switch, this is causing DBWR to write all the dirty blocks covered by the last log down to the datafile (this might include committed and uncommitted transactions).

    I only instance recover anything which has not previously been written to disk - so in the event of an instance failure in my scenario when checkpoints are only happening on log switches (FASTSTART_MTTR_TARGET isn't set) I need to recover through my current online redo log file.

    But what if a previous checkpoint has caused DBWR to write dirty blocks from an uncommitted transaction to disk - I have then, through switching overwritten this redo log file (noarchivelog) how can I this uncommitted transaction be rolled back if I no longer have a record of it in my redo log file.

    I know that you never need a previous redo log file for instance recovery and that this wouldn't be a problem - I just can't think why!!! How does oracle rollback an uncommitted transaction during instance recovery if I don't have a record of it in my redo.

    Hope this is making sense, because it's making my head sore!!

    A
    What's the sound of one hand clapping - "CL"

  5. #5
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    And one thing more...

    What my thinking is that when the database rolls forward the redo is actually rebuilding the rollback segments...

    Think of it this way, when a DML occurs on a table the undo goes to the rollback, what happens to the changes that are made in the rollback, well they go in the redo...

    So during a rollforwad the rollback segments are built up and then the database finds from these rollback segments what is uncommitted and the rolls back.

    Correct me if i'm wrong
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  6. #6
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Originally posted by alison
    how can I this uncommitted transaction be rolled back if I no longer have a record of it in my redo log file.
    As pando said, the RBS is involved too - it is used for any rollbacks that are needed. (I only learned recently that the integrity of the RBS is also preserved by redo logs!)
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  7. #7
    Join Date
    Feb 2001
    Location
    Scotland
    Posts
    200
    Thanks it's making more sense however you said

    "then in instance recovery Oracle reads Redo logs and RBS and noticed I had an uncommitted transaction so it rolls back my transaction (and hey the redo has been overwritten), so no big deal"

    Where does it notice this from, if the log recording the transaction is overwritten how does it know that this is uncommitted?

    Or is it just the fact that it has an Undo Segment and no entry in the current redo log that forces SMON (or SP) to roll it back.

    Thanks again.

    A
    What's the sound of one hand clapping - "CL"

  8. #8
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    (you beat me to it Amar!)
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  9. #9
    Join Date
    Feb 2001
    Location
    Scotland
    Posts
    200
    DAPI and adewri

    I get what your saying and that is my understanding of it as well, I know that the undo (rollback) block information is also in the redo log and is recreated in the event of a failure.

    My question is though - what if I have overwritten the redo log which records the transaction (dirty block and rollback block) and I now have dirty block(s) in my datafiles without the relevant redo log information to recreate the rollback to undo it!!
    What's the sound of one hand clapping - "CL"

  10. #10
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    My understanding is that the checkpointing ensures that this situation can not occur - i.e. anything change (for RBS or Data) that was in a redolog that is about to be overwritten must have been written to the RBS/Data file first. (I believe this is what can cause the "checkpoint not complete" message in alrt.log.)
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width