Wednesday, July 23, 2008

Types of Recovery

1. What is instance recovery ?

Instance and crash recovery are the automatic application of redo log records to Oracle data blocks after a crash or system failure. During normal operation, if an instance is shut down cleanly (as when using a SHUTDOWN IMMEDIATE statement), rather than terminated abnormally, then the in-memory changes that have not already been written to the datafiles on disk are written to disk as part of the checkpoint performed during shutdown.

However, if a single instance database crashes or if all instances of an Oracle Real Application Cluster configuration crash, then Oracle performs crash recovery at the next startup. If one or more instances of an Oracle Real Application Cluster configuration crash, then a surviving instance performs instance recovery automatically. Instance and crash recovery occur in two steps: cache recovery followed by transaction recovery.

The database can be opened as soon as cache recovery completes, so improving the performance of cache recovery is important for increasing availability.

2. What is crash recovery?

Crash recovery is same as instance recovery.

3. What is cache recovery?


Cache Recovery (Rolling Forward)
During the cache recovery step, Oracle applies all committed and uncommitted changes in the redo log files to the affected data blocks. The work required for cache recovery processing is proportional to the rate of change to the database (update transactions each second) and the time between checkpoints.


4. What is transaction recovery?

Transaction Recovery (Rolling Back)
To make the database consistent, the changes that were not committed at the time of the crash must be undone (in other words, rolled back). During the transaction recovery step, Oracle applies the rollback segments to undo the uncommitted changes.


5. What is media recovery?

Media Recovery

Datafile media recovery is sometimes also called media recovery.
Datafile media recovery is used to recover from a damaged (or lost) datafile, control file or spfile. The goal of datafile media recovery is to restore database integrity.

In order for a datafile to be able to be recovered, either:

• The database is not open, or
• The datafile is offline


A datafile that needs media recovery cannot be brought online.
A database cannot be opened if any of the online datafiles need media recovery.

A media recovery sort of replays the redo generated to a restored block, to make that block as of a certain time. Recovery of a datafile always begins with the lowest SCN recorded in the datafile header.

6. Differences to crash recovery

Datafile media recovery differs from crash recovery in the following points:
• Oracle will not initiate media recovery on its own, it must be explicitly demanded by a DBA.
• It will restore a datafile saved away in a backup. Crash recovery recovers a datafile that was left by a crash.
• Media recovery uses both archived redo logs and online redo log to recover. Crash recovery only needs the redo logs.