Saturday, March 31, 2012

RMAN redirect restore

Redirecting a restore to a different client

With Netbackup for Oracle you have the option to restore a database to a client other than the one that originally performed the backup. The process of restoring data to another client is called a redirected restore.





The user on client A cannot initiate a redirected restore to client B. Only the user on client B, which is the client receiving the backup image, can initiate the redirected restore.

The following sections describe how to perform a redirected restore using Oracle RMAN.

Server configuration


Ensure that the NetBackup server is configured to allow a redirected restore. The administrator can remove restrictions for all clients by creating the

following file on the Netbackup master server:
/usr/openv/netbackup/db/altnames/No.Restrictions


Or, to restrict clients to restore only from certain other clients, create the following file:


/usr/openv/netbackup/db/altnames/client_name



Where client_name is the name of the client allowed to do the redirected restore (the destination client). Then, add the name of the NetBackup for different server of source client to that file.

Using RMAN to perform a redirected restore

Perform the following procedure on the destination client host if you want to restore any RMAN backups that another client owns.



To perform a redirected restore


1. Enable a network connection to the RMAN catalog database that the source client used.

Note: If the RMAN catalog database has been lost, restore the catalog database first before continuing with the redirected restore.
2. Set the NB_ORA_CLIENT environment variable to the source client.
3. Check the bp.conf files on the source client. Make sure that the CLIENT_NAME variable either is not set or is set to the hostname of the source client.
4. Make the init.ora file of the source client available to the destination client. Copy the file to the destination client or modify the file on the destination

client. Change all location-specific parameters.
5. Grant write permission to the directory to which you want to restore the data files.
6 Set up a password file for the destination client database.
7 Start up the database in the nomount state.
8 Start RMAN, connecting to the catalog.
9 Set dbid to be the DBID of the source client database.
10 Connect to the target database without using a userid and password.
11 Run an RMAN restore script or type the RMAN commands for the restore.

Example
For example, assume the following:

■ Source client is Linux-MDDATA-mddsuwldb01
■ Destination client is Linux-MDDATA-mddsuwldb02
■ Master server is nbms001
■ Rman Catalog database is mddrcat
■ ORACLE_SID is mddrest
■ UNIX user is oracle on both mddsuwldb01 and mddsuwldb02





Using NetBackup for Oracle Performing a restore
1> Create the following file on server nbms001 and edit it to contain the name Linux-MDDATA-mddsuwldb01:

% touch /usr/openv/netbackup/db/altnames/Linux-MDDATA-mddsuwldb02
Or
%touch /usr/openv/netbackup/db/altnames/No.Restrictions

2> Log in to mddsuwldb02 as oracle
3> Set SERVER= nbms001 in /usr/openv/netbackup/bp.conf
This server must be the first server that is listed in the bp.conf file.
4> Modify the network tnsnames.ora file to enable RMAN catalog connection.
5> Set the environment variables ORACLE_SID to test and NB_ORA_CLIENT to camel.
6> Make sure the destination database directory exists and has appropriate access permissions. The data files are restored to the directory path with the same name they had when they were backed up.
7> Create an initmddrest.ora file.
8> Start up the database in a nomount state.

SQL>startup nomount pfile=$ORACLE_HOME/dbs/initmddrest.ora

% rman rcvcat rman/rman@mddrcat
RMAN> set dbid=
RMAN> connect target/
RMAN> run {
RMAN> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';
RMAN> SEND 'NB_ORA_SERV=nbms001, NB_ORA_CLIENT=Linux-MDDATA-mddsuwldb01';
RMAN> restore controlfile;
RMAN> }
SVRMGR> alter database mount;
%orapwd file=$ORACLE_HOME/dbs/orapwmddrest password=
%rman rcvcat rman/rman@mddrcat
RMAN>set dbid=
RMAN>connect target/
RMAN>run {
RMAN> ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';
RMAN> ALLOCATE CHANNEL CH01 TYPE 'SBT_TAPE';
RMAN> SEND 'NB_ORA_SERV= nbms001, NB_ORA_CLIENT= Linux-MDDATA-mddsuwldb01';
RMAN> restore database;
RMAN> restore archivelog all;
RMAN> }
SQL>recover database until cancel using backup controlfile;

Now apply the archived logs. Type cancel when you decide to stop
recovery.
SQL>alter database open resetlogs;

Reference : Netbackup for Oracle Administrator’s Guide for Unix and Linux