Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, krishna.

Asked: January 10, 2017 - 6:35 am UTC

Last updated: January 11, 2017 - 6:20 am UTC

Version: 11.2.0.4

Viewed 1000+ times

You Asked

Hi Team,

Can you explain below questions in details?.

1.Does undo buffer exists or changes will directly write to undo datafiles?

2.Does redo contains both undo & redo related changes?

3.If db crashes with uncommitted data in undo buffer it will get cleared automatically ,then we are able rollback database with redo ?

and Connor said...

1.Does undo buffer exists or changes will directly write to undo datafiles?

Undo blocks are database blocks, so they will sit in the buffer cache like others, eg

SQL> select count(*)
  2  from v$bh
  3  where file# in (
  4    select file#
  5    from   v$datafile
  6    where  name like '%UNDO%' );

  COUNT(*)
----------
      5473



2.Does redo contains both undo & redo related changes?

Yes. Any change to any block (undo or otherwise) is protected by redo (unless explicitly instructed not to)


3.If db crashes with uncommitted data in undo buffer it will get cleared automatically ,then we are able rollback database with redo ?

During instance restart, we do instance recovery. We use the redo logs to resurrect all the changes to database blocks, which *includes* undo blocks. Those undo blocks can then be used to undo any uncommitted transactions (ie, uncommitted at the time of the crash)

Rating

  (1 rating)

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

Comments

A reader, January 11, 2017 - 5:09 am UTC

Excellent
Connor McDonald
January 11, 2017 - 6:20 am UTC

glad we could help