When you
perform complete recovery, you bring the database to the state where it is
fully up-to-date, including all committed data modifications to the present
time. Incomplete recovery, however, brings the database to some point in the
past. This means there are missing transactions; any data modifications done
between the recovery destination time and the present are lost. In many cases,
this is the desirable goal because there may have been some changes made to the
database that need to be undone. Recovering to a point in the past is a way to
remove the unwanted changes.
Complete
Recovery Process
The
following steps describe what takes place during complete recovery following
the loss of data files:
1. Damaged
or missing files are restored from a backup.
2. Changes
from incremental backups, archived redo log files, and online redo log files
are applied as necessary. The redo log changes are applied to the data files
until the current online log is reached and the most recent transactions have
been reentered. Undo blocks are generated during this entire process. This is
referred to as rolling forward or cache recovery.
3. The
restored data files may now contain committed and uncommitted changes.
4. The
database is opened before undo is applied. This is to provide higher
availability.
5. The undo
blocks are used to roll back any uncommitted changes. This is sometimes
referred to as transaction recovery.
6. The data
files are now in a recovered state and are consistent with the other data files
in the database.
Note: Even if the database is opened
read-only, the undo data is applied for uncommitted transactions.
Incomplete
Recovery Process
Incomplete
recovery, or database point-in-time recovery, uses a backup to produce a
noncurrent version of the database. That is, you do not apply all of the redo
records generated after the most recent backup. Perform this type of recovery
only when absolutely necessary. To perform incomplete recovery, you need:
•
A
valid offline or online backup of all the data files made before the recovery
point
•
All
archived logs from the time of the backup until the specified time of recovery
The
progression taken to perform an incomplete recovery is listed below:
1. Restore the data files from backup: The
backup that is used may not be the most recent one, if your restore point
destination is to be not very recent. This entails either copying files using
OS commands or using the RMAN RESTORE command.
2. Use the RECOVER command: Apply
redo from the archived redo log files, including as many as necessary to reach
the restore point destination.
3. State of over-recovery: Now the
data files contain some committed and some uncommitted transactions because the
redo can contain uncommitted data.
4. Use the ALTER DATABASE OPEN command:
The database is opened before undo is applied. This is to provide higher
availability.
5. Apply undo data: While the redo
was being applied, redo supporting the undo data files was also applied. So,
the undo is available to be applied to the data files in order to undo any
uncommitted transactions. That is done next.
6. Process complete: The data files
are now recovered to the point in time that you chose.
Point-in-time
recovery is the only option if you must perform a recovery and discover that
you are missing an archived log containing transactions that occurred sometime
between the time of the backup you are restoring from and the target recovery
SCN. Without the missing log, you have no record of the updates to your data
files during that period. Your only choice is to recover the database from the
point in time of the restored backup, as far as the unbroken series of archived
logs permits, and then open the database with the RESETLOGS option. All changes
in or after the missing redo log file are lost.