Performing Disaster Recovery
Disaster recovery includes the restoration and recovery of the target database after the loss of the entire target database, the recovery catalog database, all current control files, all online redo log files, and all parameter files.
- Prerequisites of Disaster Recovery
To perform a disaster recovery, you must have the following:
- Backups of all data files
- All archived redo logs generated after the creation time of the oldest backup that you intend to restore
- At least one control file autobackup
- A record of the DBID of the database
- Recovering the Database After a Disaster
The scenario assumes the following: Oracle Database is installed on the new host.
To recover the database on the new host:
- If possible, restore or re-create all relevant network files such as tnsnames.ora and listener.ora and a password file.
- Start RMAN and connect to the target database instance.
- Specify the DBID for the target database with the SET DBID command
SET DBID 676549873;
- Run the STARTUP NOMOUNT command.
- Allocate a channel to the media manager and then restore the server parameter file from autobackup.
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RESTORE SPFILE FROM AUTOBACKUP; }
- Restart the instance with the restored server parameter file.
STARTUP FORCE NOMOUNT;
- Write a command file to perform the restore and recovery operation, and then execute the command file. The command file must do the following:
- Allocate a channel to the media manager.
- Restore a control file autobackup
- Mount the restored control file.
- Catalog any backups not recorded in the repository with the CATALOG command.
- Restore the data files to their original locations. If volume names have changed, then run SET NEWNAME commands before the restore operation and perform a switch after the restore operation to update the control file with the new locations for the data files, as shown in the following example.
- Recover the data files. RMAN stops recovery when it reaches the log sequence number specified.
RMAN> RUN {
# Manually allocate a channel to the media manager
ALLOCATE CHANNEL t1 DEVICE TYPE sbt;
# Restore autobackup of the control file. This example assumes that you have
# accepted the default format for the autobackup name.
RESTORE CONTROLFILE FROM AUTOBACKUP;
# The set until command is used in case the database
# structure has changed in the most recent backups, and you want to
# recover to that point in time. In this way RMAN restores the database
# to the same structure that the database had at the specified time.
ALTER DATABASE MOUNT;
SET UNTIL SEQUENCE 1124 THREAD 1;
RESTORE DATABASE;
RECOVER DATABASE; }
The following example of the RUN command shows the same scenario except with new file names for the restored data files:
RMAN> RUN {
# If you must restore the files to new locations,
# use SET NEWNAME commands:
SET NEWNAME FOR DATAFILE 1 TO '/dev/vgd_1_0/rlvt5_500M_1';
SET NEWNAME FOR DATAFILE 2 TO '/dev/vgd_1_0/rlvt5_500M_2';
SET NEWNAME FOR DATAFILE 3 TO '/dev/vgd_1_0/rlvt5_500M_3';
ALLOCATE CHANNEL t1 DEVICE TYPE sbt;
RESTORE CONTROLFILE FROM AUTOBACKUP;
ALTER DATABASE MOUNT;
SET UNTIL SEQUENCE 124 THREAD 1;
RESTORE DATABASE;
SWITCH DATAFILE ALL; # Update control file with new location of data files.
RECOVER DATABASE; }
- If recovery was successful, then open the database and reset the online logs:
ALTER DATABASE OPEN RESETLOGS;
本文详细介绍了在发生灾难导致数据库完全丢失后进行恢复的过程。包括必备条件如数据文件备份、归档日志等,以及具体步骤如启动RMAN、设置数据库标识、恢复参数文件和控制文件等内容。
1128

被折叠的 条评论
为什么被折叠?



