How to restore the RMAN standby backup to a new server


Assuming that you have already use RMAN to backup your standby database into flashback recovery area (db_recovery_file_dest).

So, if your db_recovery_file_dest=’/recovery_area’, then your backup will be at the following location by default. On the new server create the recovery area and restore the backup.

Default:
/recovery_area/<SID>/backupset
/recovery_area/<SID>/autobackup

On the empty server, we assume you have already cloned the Oracle binaries and set your global variables such as ORACLE_HOME, ORACLE_SID, etc.

Run the RMAN tool and login as sys. Then set your DBID to restore spfile and controlfiles. If you don’t know where your controlfiles are located first restore spfile then create pfile and check the location and then build it if they are not exist.

# rman target /
RMAN> SET DBID xxxxxxxxxxxx;
RMAN> STARTUP FORCE NOMOUNT;
RMAN> show all; — to display default rman configurations.

To restore spfile:
RMAN> restore spfile from autobackup db_recovery_file_dest=’/recovery_area’ db_name=’orcl’;
Now, you can goto SQLPLUS and create your parameter file.
SQL> create pfile from spfile;
To restore controlfiles:
RMAN> restore controlfile from autobackup db_recovery_file_dest=’/recovery_area’ db_name=’orcl’;
Note: if your controlfiles’ destination were not set, rman will copy one to $ORACLE_HOME/dbs/cntrl<sid>.dbf.
Now, from parameter file, you will know where adump, bdump, cdump and udump location are. Create adump, bdump, cdump, log and udump
Shutdown and startup with mount option to find other datafiles location on the database from controlfile.
SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE BACKUP controlfile TO TRACE;
Print the trace file located at udump.

Restore the database:
RMAN> restore database;

If you have missing logs do the following:
Now go to your archivelog location and check your last archivelog sequence number. It should be more than value from the following query.
SQL> SELELCT * FROM v$log;

Then recover until the last sequence number;
RMAN> recover database until sequence your-number;

If you have get flashback recovery on/off error message, try to turn it off.
SQL> ALTER DATABASE flashback OFF;
SQL> shutdown immediate;
SQL> startup mount;
SQL> recover database until sequence 52;
SQL> ALTER DATABASE OPEN resetlogs;

If you hav all your archivelogs:
Go to primary database and switch logfile and copy all archivelogs to the new server. Then create trace file with noresetlogs option.
# scp arch*.log oracle@yournew-server:$DB_RECOVERY_FILE_AREA/<sid>/archivelog/.

On SQLPLUS:
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE as ‘/home/oracle/myprim-cntl.sql’ NORESETLOGS;

Copy the myprim-cntl.sql file to your new server. And edit it to replace the existing controlfiles.

Shutdown the database.
SQL> shutdown immediate;
SQL> @myprim-cntl.sql

Source Knowledge : http://www.iselfschooling.com/board/index.php?topic=707.0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s