RMAN: Restoring an RMAN Backup to Another Node [ID 73974.1]

RMAN: Restoring an RMAN Backup to Another Node [ID 73974.1]

 Modified 19-OCT-2010     Type BULLETIN     Status PUBLISHED 

Checked for relevance on 02-JUL-2010

PURPOSE
------- 
 The purpose of this document is to demonstrate a restore of an RMAN backup to 
a different host than the original target.

SCOPE & APPLICATION
--------------------

 This note is intended for DBAs and Support Personnel.

NOTE: This document is using a UNIX example. For MS Windows,
      certain commands might have a different syntax.
      eq : On Windows : orapwd file=$ORACLE_HOME/database/PWD$ORACLE_SID password=kernel

      This document is using commands available in any version upto RMAN 11g.
      However RMAN 10g onwards has more options available like CATALOG BACKUPPIECE
      which removes the restriction of having the backups readable on the same
      location as they have been made.

      RMAN 10g related information :
      - Note 340848.1 Performing duplicate database with ASM/OMF/RMAN
      - Note 382669.1 Duplicate database from non ASM to ASM (vise versa) to a different host
      - Note.388431.1 Creating a Duplicate Database on a New Host. 

      RMAN 11g related information :
      - Note.452868.1 RMAN 'Duplicate Database' Feature in 11G 
      - Note.1113713.1 Creation Of Rman Duplicate Without Target And Recovery Catalog Connection.


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.

From version 8.1.5, the RMAN 'duplicate' command could be used, as discussed in
Note:73912.1. However, prior to 8.1.5, the 'duplicate' command does not exist. 

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

These steps are expanded further below. 

1.0 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;
allocate channel t2 type disk;
allocate channel t3 type disk;

#backup the whole db
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';

}

2.0 List Datafile Locations on Host A
-------------------------------------

The datafile numbers and location on host A are required. These datafile
locations will change on host B (see Section 7.3).

SVRMGR> 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 (see Section 7.4).

SVRMGR> 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

3.0 Make the Backups Available to Host B
----------------------------------------

3.1 Disk Backups

During restore, RMAN will expect the backup sets to be located in the same
directory as written to during the backup. For disk backups, the DBA can 
accomplish this in many ways:

   - set up an NFS directory, mounted on both host A and host B
   - create the same directory structure on host A and host B
   - use of symbolic links on host B

3.2 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.

4.0 init.ora on host B
----------------------

The "init.ora" needs to be made available on host B. Any location specific 
parameters must be ammended. For example,
  - ifile
  - *_dump_dest
  - log_archive_dest*
  - control_files

5.0 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
    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   


6.0 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
 

7.0 Recover Duplicated Database
-------------------------------

7.1 startup nomount the database

    SVRMGR> startup nomount pfile=<location of init.ora>

7.2 restore the controlfile(s)
    
    For example,
    run{
      allocate channel c1 type disk;
      restore controlfile;
    }
7.2 mount the database

    SVRMGR> alter database mount;

7.3 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 (see Section 2) 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;
    }

7.4 recover and open the database
    Perform incomplete recovery: 
    
    SVRMGR> recover database using backup controlfile until cancel;
    
    Forward the database applying archived redo log files until you decide 
    to stop recovery by typing cancel at the prompt (assuming that you have
    required archived redo log files in the log_archive_dest directory)
    You may archive the source database redo log files and apply them at 
    the target database if required.
    
       
    SVRMGR> alter database open resetlogs;
    
    Note: this will create the online redo logs in the same location as that
    on host A. If this directory location does not exist, then this will fail
    with:
    ora-344 : unable to recreate online log <name>

    The workaround is to rename the logfiles prior to opening the database:
    SVRMGR> alter database rename file 
            '<host A location>' to '<host B location>';

    Alternatively, the logfile groups can be dropped and recreated. However,
    attempts to drop the current logfile group will fail. The current logfile
    must be renamed.


Related Documents:
==================

Note:73912.1: RMAN: Creating a Duplicate Database
Note:50875.1: Getting started with Server-Managed Recovery (SMR) and RMAN
Oracle8 Backup and Recovery Guide 
Oracle8i Recovery Manager User's Guide and Reference

The Oracle documentation is available online at http://otn.oracle.com 
and http://tahiti.oracle.com.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值