Restoring an RMAN Backup to Another Node
In certain circumstances, it may be desirable to restore a database from an RMAN backup onto a machine other than the original host. For example, to recover data at a given point in time, or to duplicate a production instance.
The example assumes:
The target database is on host A
The database is to be restored onto host B
The directory structure of host B is different to host A
The ORACLE_SID will not change for the restored database
A recovery catalog is being used
The backups were carried out to disk (for illustrative purposes, and to disassociate from any media manager specific issues)
The following steps are required:
Backup the target on host A
List the datafile locations on host A
Make the backup available to host B
Make a copy of the init.ora available to host B
Edit the init.ora to reflect directory structure changes
Configure SQL*Net connectivity from host to the recovery catalog and duplicated database
Set up a password file for the duplicated database
Startup nomount the duplicated database
RMAN restore the controlfile(s)
Mount the database
Restore and rename the datafiles
Recover and open the database
Step:1 Backup the Target on Host A
The target database needs to be backed up using RMAN.
The following is one example of RMAN doing an online database backup. In this
example, the backup sets are written to disk.
run {
allocate channel t1 type disk;
backup
tag whole_database_open
format ‘/oracle/backups/BFS/df_%u’
database;
# switch out of the current logfile
sql ‘alter system archive log current’;
#backup the archived logs
backup archivelog all
format ‘/oracle/backups/BFS/al_%u’;
# backup a copy of the controlfile that contains records for the
# other backups just made
backup current controlfile tag = cf1 format ‘/oracle/backups/BFS/cf_%u’;
}
Step: 2 List Datafile Locations on Host A
The datafile numbers and location on host A are required. These datafile locations will change on host B
SQL> select file#, name from v$datafile;
file# name
—– ——————————
1 /oracle/OFA_base/u01/oradata/V805X/system01.dbf
2 /oracle/OFA_base/u01/oradata/V805X/rbs01.dbf
3 /oracle/OFA_base/u01/oradata/V805X/temp01.dbf
4 /oracle/OFA_base/u01/oradata/V805X/tools01.dbf
5 /oracle/OFA_base/u01/oradata/V805X/users01.dbf
6 /oracle/OFA_base/u01/oradata/V805X/users02.dbf
7 /oracle/OFA_base/u01/oradata/V805X/rbs02.dbf
8 /oracle/OFA_base/u01/oradata/V805X/rcvcat.dbf
The log file names should also be recorded.
SQL> select group#, member from v$logfile;
group# member
—– ——————————
1 /oracle/OFA_base/u01/oradata/V805X/redo01.log
2 /oracle/OFA_base/u01/oradata/V805X/redo02.log
3 /oracle/OFA_base/u01/oradata/V805X/redo03.log
Step: 3 Make the Backups Available to Host B
Disk Backups
During restore, RMAN will expect the backup sets to be located in the same directory as written to during the backup.
Tape Backups
The media management software must be configured such that host B is a media manager client, and can read the backup sets. The media management vendor should be consulted for support on this issue.
Step: 4 init.ora on host B
The “init.ora” needs to be made available on host B. Any location specific parameters must be amended. For example, ifile, *_dump_dest, log_archive_dest*, control_files
Step: 5 SQL*Net configuration
If running RMAN from host A:
A. Connectivity to the catalog remains unchanged
B. Configure tnsnames.ora on host A to connect to duplicated db on host B
C. Configure listener.ora on host B to accept connections for duplicated database
If running RMAN from host B:
A Configure tnsnames.ora on host B to connect to catalog listener.ora on catalog host remains unchanged
B. Configure tnsnames.ora on host B to connect to duplicated db on host B configure listener.ora on host B to accept connections for duplicated database
If running RMAN from host C (ie, neither host A or host B):
A. Connectivity to the catalog remains unchanged
B. Configure tnsnames.ora on host C to connect to duplicated db on host B configure listener.ora on host B to accept connections for duplicated database
Step: 6 Setup Password File
In order to allow RMAN remote connections, a password file must be setup for the duplicated database. For example,
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=kernel
Step: 7 Recover Duplicated Database
Startup nomount the database
SQL> startup nomount pfile=
Restore the controlfile(s)
For example,
run{
allocate channel c1 type disk;
restore controlfile;
}
Mount the database
SQL> alter database mount;
Rename and restore the datafiles, and perform database recovery
RMAN can be used to change the location of the datafiles from the location on host A to the new location on host B.
For example,
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
set newname for datafile 1 to ‘/oracle/datafiles/system01.dbf’;
set newname for datafile 2 to ‘/oracle/datafiles/rbs01.dbf’;
set newname for datafile 3 to ‘/oracle/datafiles/temp01.dbf’;
set newname for datafile 4 to ‘/oracle/datafiles/tools01.dbf’;
set newname for datafile 5 to ‘/oracle/datafiles/users01.dbf’;
set newname for datafile 6 to ‘/oracle/datafiles/users02.dbf’;
set newname for datafile 7 to ‘/oracle/datafiles/rbs02.dbf’;
set newname for datafile 8 to ‘/oracle/datafiles/rcvcat.dbf’;
restore database;
switch datafile all;
}
Recover and open the database
Responses