Previous Topic: Restore Point-in-TimeNext Topic: Database Recovery


Recovery Manager (RMAN) and Restoring a Database to an Alternate Server

When restoring a database to an alternate server using RMAN directly, the following prerequisites are required:

For example, consider the following scenario:

Note: The scenario used in the following procedure assumes that the database backed up from <Server-A> will be restored to <Server-B>, and that the database name will be preserved. It also assumes that the directory structure of the original and destination hosts are the same. In addition, this scenario assumes you are using Oracle 10gR2.

To restore a database to an alternate server, perform the following steps:

  1. Edit /etc/oratab from the alternate Server-B server and add the following line to the original database instance src as the oracle user:
    src:/opt/oracle/10gR2:N
    
  2. Perform Oracle netca (oracle net configuration assistance) tool to configure one TNS name for the RMAN catalog database catdb and ensure that it is visible from the database installed on Server-B as the oracle user.
  3. Create the same directory structure as the original Server-A with the oracle user.

    For example:

    $cd $ORACLE_BASE/admin
    $mkdir src
    $mkdir adump  bdump  cdump  dpdump  pfile  udump
    $mkdir -p $ORACLE_BASE/oradata/src
    $mkdir -p $ORACLE_BASE/flash_recovery_area/SRC
    
  4. Run orasetup to configure the oracle agent for the original database on the alternate server (Server-B).
    # /opt/Arcserve/ABoraagt/orasetup
    
    

    When orasetup prompts you to use a Recovery Manager catalog to handle database backups, specify ‘y’.

    Are you planning on using a Recovery Manager catalog to handle database backups (Recommended)? (Y/N) Y
    
    

    When orasetup prompts you to specify the name of the Oracle instance, specify the original instance ID.

    Oracle instance id to be used by this agent [<Enter> to end]: src
    ORACLE_HOME environment value for this Oracle instance: (default:/opt/oracle/10gR2):
    
    

    When orasetup prompts you to specify the name of the Recovery Manager service name, specify the configured TNS name for the RMAN catalog database.

    Since you have configured the Recovery Manager, please provide  the Recovery Manager service name for database src.
    Recovery Manager service name : catdb
    
  5. Edit the sbt.cfg file on Server-B under /opt/Arcserve/ABoraagt folder. Remove the following "#" and enter the hostname for Server-A.
    # Node where the original backup was made from
    SBT_ORIGINAL_CLIENT_HOST=Server-A.
    
  6. Ensure that you are able to ping by the hostname from the Arcserve Backup server to Server-B and vice versa.
  7. Add one pfile to the alternate server (Server-B).
  8. Startup the src database with the "nomount" option using the created pfile.
    $export ORACLE_SID=src
    $sqlplus /nolog
    SQL>conn sys/passw0rd as sysdba
    SQL>startup nomount pfile=$ORACLE_HOME/dbs/init$ORACLE_SID.ora
    SQL>exit
    
  9. Restore spfile using the RMAN catalog.
    $rman catalog rman/rman@catdb
    RMAN> set dbid=<source database db_id value> 
    RMAN> connect target system/passw0rd;
    RMAN>run {
    2>allocate channel ch1 type sbt parms='SBT_LIBRARY=/opt/Arcserve/ABoraagt/libobk64.so';
    3>restore spfile;
    4>release channel  ch1;
    5>}
    

    Note: For a 32-bit Oracle database, the SBT_LIBRARY uses libobk32.so. For a 64-bit Oracle database, the SBT_LIBRARY uses libobk64.so.

    The restore job runs on the Arcserve Backup Server job queue. When the job completes, the spfile database restores to the $ORACLE_HOME/dbs path.

    Shut down the database.

    RMAN>shutdown immediate;
    RMAN>exit
    

    Restart the database with the "nomount" option using the spfile you just restored.

    $sqlplus /nolog
    SQL>conn sys/passw0rd as sysdba
    SQL>startup nomount
    SQL>quit
    
  10. Restore the control file.
    $rman catalog rman/rman@catdb
    RMAN> set dbid=<source database db_id value> 
    RMAN> connect target system/passw0rd;
    RMAN> run { 
    2> allocate channel dev1 type 'sbt_tape' 
    parms='SBT_LIBRARY=/opt/Arcserve/ABoraagt/libobk64.so'; 
    3> restore controlfile; 
    4> release channel dev1; 
    5> } 
    

    Alternatively if you restore the control file from a specific backup piece to perform a point in time restore, then perform the following steps:

    $ rman catalog rman/rman@catdb
    RMAN> set dbid=<source database db_id value> 
    RMAN> connect target system/passw0rd;
    RMAN> run { 
    2> allocate channel dev1 type 'sbt_tape' 
    parms='SBT_LIBRARY=/opt/Arcserve/ABoraagt/libobk64.so'; 
    3> restore controlfile from ‘Y’; 
    4> release channel dev1; 
    5> } 
    

    To obtain ‘Y’, which denotes the backup piece information, perform the following:

    RMAN> set dbid=<dbid>; 
    RMAN> list backup of controlfile; 
    

    The restore job runs on the Arcserve Backup Server job queue. When the job completes, the database control files are restored to the $ORACLE_HOME/oradata/$ORACLE_SID path.

  11. When the control file is restored, mount the database.
    $sqlplus / as sysdba
    SQL>alter database mount;
    SQL>exit
    
  12. Restore the database and archive the logs.
    $rman catalog rman/rman@catdb
    RMAN> set dbid=<source database db_id value>
    RMAN> connect target system/passw0rd;
    RMAN>run {
    2>allocate channel ch1 type sbt parms='SBT_LIBRARY=/opt/Arcserve/ABoraagt/libobk64.so';
    3>restore database;
    4>restore archivelog all;
    5>release channel  ch1;
    6>}
    

    The restore job runs on the Arcserve Backup Server job queue. When the job completes, the database files and the archive logs are restored.

  13. Use the backup controlfile to recover the database and then open the database.
    $sqlplus / as sysdba
    SQL> recover database using backup controlfile until cancel
    
  14. Enter the following command to open the database with the resetlogs option:
    SQL> alter database open resetlogs;