Friday 18 November 2011

Restore RMAN full backup to different server with same database name and similar directory structure

In this article we are going to learn, how to restore RMAN full backup to a different server with same database name and similar directory structure.


Overview:
This article is a comprehensive guide for restoring RMAN full backup to a different server with same database name and similar directory structure.
Please do keep in mind that this article should not be considered a substitution of the official guide from Oracle (http://www.oracle.com). The below mentioned link can be used to download the official documentation for RMAN Recovery Techniques.
Names used in this article:
 Name  Value
 Database Name  mydb
 Backup Folder  c:\rman_bck



Connect to the database:
Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
Create initialization parameter file (pfile).
sql>create pfile from spfile ;




Take Full Backup of Database using RMAN:
Open command prompt and type the below mentioned:
cmd> rman target /
We can configure the backup location (if not configured earlier). For configuring backup location type the following command:
RMAN> configure channel device type disk format 'C:\rman_bck\mydb_%U' ;

For taking backup of the database, fire the below mentioned command:
RMAN> backup database plus archivelog ;

The above activity will take some time, depending upon the database size.
For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/
Copy the required files to the other node:
Note:Make sure all rman backup files from Node1 are in the same location(s) in the new server(Node2) as the source server(Node1) (same path names and directory structure ).
Copy the below mentioned files to the other node:
--The backup pieces generated using RMAN.
--The insitalization parameter file( created above).
--The password file( We can create it also on the other node).




Create similar directory structure on other node:
Create "oradata/mydb" directory on the other node ( for storing controlfiles,datafiles,redo logfiles ). Also create Archive Destination Directory.


 For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/

Create Service/instance on other node:
Note:This step needs to be performed only on Windows O/S.
Create a service( Here in my case my datbase name -- mydb ).For creating service use "oradim" utility. As mentioned below:
cmd> oradim -new -sid mydb -intpwd sys -startmode manual

After creating the service, change its startmode to automatic. For doing so go to "windows services" and change its properties.  




Start the database in nomount mode on other node:
Open command prompt and type the below mentioned:
cmd> set ORACLE_SID=mydb
cmd> sqlplus / as sysdba
sql> startup nomount pfile='full_path_of_pfile' ;


 For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/


Invoke Rman on other node:
Open command prompt and type the below mentioned:
cmd> rman target /
Restore the controlfile from the backup pieces as mentioned below:
RMAN> restore controlfile from 'full_path_control_file_bck_piece' ;

After restoring the controlfile from the backup pieces mount the database :
RMAN> alter database mount ;


After mounting the database, restore it as mentioned below:
RMAN> restore database ;

After restoring the database, recover it as mentioned below:
RMAN> recover database ;


If it show error ("media recovery requesting unknown archived log") that means, it requires the new archivelogs ,copy the new archivelogs from node1 to node2.
We can ignore the error.
For not encountering this error we can use "until" option with the above command.

After that, open the database with resetlogs options. As mentioned below:
RMAN> alter database open resetlogs;



After that, Connect to the database and create spfile. As mentioned below:
cmd> sqlplus / as sysdba
SQL> create spfile from pfile='pfile_location';


For the complete screenshot of the activities plesae visit the followong link::: http://www.sensehaze.com/



























No comments:

Post a Comment