Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Wednesday, 23 January 2013

Duplicate Database with RMAN without Connecting to Target Database

Tested on Oracle 10g database:
Platform: Windows 2003
Scenario: Assume that you have same Platform and Oracle version installed on destination server and you have already copied the Backup to the destination server same location. You have already created the oracle service (for windows env. only) and password file and tns configuration for destination server. For details about the above concept follow my other post: Create Duplicate Oracle Server in Oracle 9i

cmd> set oracle_sid = sid_name_of_database
Create pfile and copy to the destination server location.
Edit this pfile and give db_name=<dbname of production> and control_files=<location where you want controlfile to be restored>. If you do not want to change leave it as it is.

cmd> sqlplus /nolog
cmd> connect / as sysdba
Connected to an idle instance.

SQL> Startup force nomount  pfile = <Pfile with full location>;
SQL> Create spfile from pfile = <pfile with full location>;
Now connect to the rman and list the backup summary to conform the backup repository and then restore the controlfile by using any of the below method:
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
RMAN> RESTORE CONTROLFILE FROM "\\testdb\orcl3\c-691421794-20120506-01";
RMAN> restore controlfile from "H:\ORABACK\C-1103102985-20100216-02";

RMAN> ALTER DATABASE MOUNT;
Note: Make sure that backup pieces are on the same location where it was there on production db. If you don’t have the same location, then make RMAN aware of the changed location using “catalog” command.

RMAN>catalog backuppiece <piece name and path>;
If there are more backuppieces, than they can be cataloged using command :
RMAN>catalog start with <path where backuppieces are stored>;

After cataloging backup piece, issue “restore database” command. If you need to restore datafiles to a location different to the one recorded in controlfile, use SET NEWNAME command as below:
run {
set newname for datafile 1 to ‘/newLocation/system.dbf’;
set newname for datafile 2 to ‘/newLocation/undotbs.dbf’;
- otherwise-
RMAN> Restore database;
RMAN> Switch datafile all;

0 comments:

Post a Comment