Performing Complete Recovery of the
Whole Database
This scenario assumes that database trgt has lost most
or all of its datafiles. It also assumes that the database uses a fast recovery
area.
After restore and recovery of a whole database, when the database
is open, missing temporary tablespaces that were recorded in the control file
are re-created with their previous creation size, AUTOEXTEND, and MAXSIZE attributes.
Only temporary tablespaces that are missing are re-created. If a tempfile
exists at the location recorded in the RMAN repository but has an invalid
header, then RMAN does not re-create the tempfile.
If the tempfiles were originally created as Oracle managed files,
then they are re-created in the current DB_CREATE_FILE_DEST location.
Otherwise, they are re-created at their previous locations. If RMAN is unable
to re-create the file due to an I/O error or some other cause, then the error
is reported in the alert log and the database open operation continues.
- Start
RMAN and connect to a target database.
For example, enter the following command:
% rman
RMAN> CONNECT TARGET /
RMAN displays the database status when it connects: not started, not mounted, not open (when the
database is mounted but not open), or none (when the database is open).
- If
the database is not mounted, then mount but do not open the database.
For example, enter the following command:
STARTUP MOUNT;
- Use
the SHOW command to see which
channels are preconfigured.
For example, enter the following command (sample output is
included):
SHOW ALL;
RMAN configuration parameters for database with db_unique_name
PROD1 are:
.
.
.
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
# default
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS
"SBT_LIBRARY=/usr/local/oracle/backup/lib/libobk.so";
If the necessary devices and channels are already configured, then
no action is necessary. Otherwise, you can use the CONFIGURE command to
configure automatic channels, or include ALLOCATE CHANNEL commands
within a RUN block.
- If
restoring password-protected encrypted backups, then specify the password.
Use the SET DECRYPTION IDENTIFIED BY command to
specify a password for password-protected backups, as shown in the following
example (where passwordrepresents the actual password that you
enter):
SET DECRYPTION IDENTIFIED BY password;
If you created backups with different passwords, then you can run
the SET DECRYPTION IDENTIFIED BY password command
multiple times, specifying all of the possible passwords that might be required
to restore the backups.
- Restore
and recover the database. Do one of the following:
- If
you are restoring all datafiles to their original locations, then execute RESTORE DATABASE and RECOVER DATABASE sequentially at the
RMAN prompt.
For example, enter the following commands if automatic channels
are configured (sample output included):
RMAN> RESTORE DATABASE;
Starting restore at 20-JUN-06
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=34 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup
set
channel ORA_DISK_1: restoring datafile 00001 to
/disk1/oracle/dbs/tbs_01.f
channel ORA_DISK_1: restoring datafile 00002 to
/disk1/oracle/dbs/tbs_ax1.f
.
.
.
Finished restore at 20-JUN-06
RMAN> RECOVER DATABASE;
Starting recover at 20-JUN-06
using channel ORA_DISK_1
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=34 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
starting media recovery
channel ORA_DISK_1: starting archived log restore to default
destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
.
.
.
channel ORA_DISK_1: reading from backup piece
/disk1/oracle/work/orcva/TKRM/backupset/2007_06_20/o1_mf_annnn_TAG20070620T113128_29jhr197_.bkp
channel ORA_DISK_1: piece
handle=/disk1/oracle/work/orcva/TKRM/backupset/2007_06_20/o1_mf_annnn_TAG20070620T113128_29jhr197_.bkp
tag=TAG20070620T113128
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archived log file
name=/disk1/oracle/work/orcva/TKRM/archivelog/2007_06_20/o1_mf_1_5_29jhv47k_.arc
thread=1 sequence=5
channel default: deleting archived log(s)
.
.
.
media recovery complete, elapsed time: 00:00:15
Finished recover at 20-JUN-06
If you manually allocate channels, then you must issue the RESTORE and RECOVER commands
together within a RUN block as shown in the following example:
RUN
{
ALLOCATE CHANNEL c1 DEVICE
TYPE sbt;
RESTORE DATABASE;
RECOVER DATABASE;
}
- If
you are restoring some datafiles to new locations, then execute RESTORE DATABASE and RECOVER DATABASE sequentially in a RUN command. Use the SET NEWNAME to rename datafiles.
- The
following example restores the database, specifying new names for three
of the datafiles, and then recovers the database:
RUN
{
SET NEWNAME FOR DATAFILE 2
TO '/disk2/df2.dbf';
SET NEWNAME FOR DATAFILE 3
TO '/disk2/df3.dbf';
SET NEWNAME FOR DATAFILE 4
TO '/disk2/df4.dbf';
RESTORE DATABASE;
SWITCH DATAFILE ALL;
RECOVER DATABASE;
}
- Examine
the output to see if media recovery was successful. If so, open the
database.
For example, enter the following command:
ALTER DATABASE OPEN;


No comments