RelationalDBDesign RelationalDBDesign


Incomplete Recovery   «Prev  Next»

Incomplete Database Recovery Steps

The correct order is as follows:
  1. Perform a whole closed database backup.
  2. Restore all datafiles.
  3. Mount the database.
  4. Recover the datafiles to a specified point-in-time before the failure.
  5. Open the database with RESETLOGS command.
  6. Shut down and perform a whole database backup.

Background

Incomplete database recovery consists of two steps: 1) restore and 2) recovery. The restore step will re-create data files, and the recover step will apply redo up to the specified point in time. The restore process can be initiated from RMAN in several ways:
  1. restore database until
  2. restore tablespace until
  3. flashback database
For the majority of incomplete database recovery circumstances, you’ll use the restore database until command to instruct RMAN to retrieve data files from the RMAN backup files. This type of incomplete database recovery is the main focus of this chapter. The until portion of the restore database command instructs RMAN to retrieve data files from a point in the past based on one of the following methods:
  1. Time
  2. Change (sometimes called system change number [SCN])
  3. Log sequence number
  4. Restore point

The RMAN restore database until command will retrieve all data files from the most recent backup set or image copy. RMAN will automatically determine from the until clause which backup set contains the required data files. If you omit the until clause of the restore database command, RMAN will retrieve data files from the latest available backup set or image copy. In some situations, that may be the behavior you desire. We recommend you use the until clause to ensure that RMAN restores from the correct backup set or image copy. When you issue the restore database until command, RMAN will determine how to extract the data files from any of the following:
  1. Full database backup
  2. Incremental level 0 backup
  3. Image copy backup generated by the backup as copy command
You cannot perform an incomplete database recovery on a subset of your database's online data files. When performing incomplete database recovery, all of the checkpoint SCNs for all online data files must be synchronized before you can open your database with the alter database open resetlogs command. You can view the data file header SCNs and the status of each data file via this SQL query:

select
file#
,status
,fuzzy
,error
,checkpoint_change#,
to_char(checkpoint_time,'dd-mon-rrrr hh24:mi:ss') as checkpoint_time
from v$datafile_header;

The FUZZY column of V$DATAFILE_HEADER refers to a data file that contains one or more blocks that have an SCN greater than or equal to the checkpoint SCN in the data file header (meaning there have been writes to the data file since the last checkpoint). During regular database operating conditions, the FUZZY column will normally be YES. However, after you restore a data file, if a data file has a FUZZY value of YES, you cannot open the database normally yet; in this situation more redo needs to be applied before the database can be opened. Table 12-1 summarizes these scenarios.