Wednesday, November 02, 2011

Restore Oracle RMAN backup on a new Windows machine

Sometimes disaster strucks (ex. virus, disk failures, etc..) and the only option to get up and running is to restore our Oracle backup onto a new Windows server. This article simplifies the whole process of completely restoring and recovering a database on a brand new Windows server.

1) It is important that we maintain the same directory structure as the original server when restoring Oracle through RMAN. Gather information about your directory structure from your previous (failed) machine:
  • Datafile Location
  • Archivelog Location
  • Oracle Binaries Location
  • RMAN Backups Location
2) Install Oracle software with the same Oracle version as the original server.

3) Place the RMAN backups in the appropriate location as defined in the controlfile.

4) Create Windows service for the database:

C:\>oradim -new  -sid ORCL -startmode m
C:\>oradim -edit -sid ORCL -startmode a

Make sure that the service is started so we may be able to connect to it in the next steps.

5) Get the DBID of the database - I normally get it from the backup report - although this steps is not really necessary (since we restore the SPFILE first) I do recommend it.

6) Create bdump,udump,cdump and create folder at $ORACLE_HOME (if using Oracle versions before 11g)

7) Connect with rman to the target database at local server:

C:\>Documents and Settings\Administrator>set ORACLE_SID=ORCL
C:\>Documents and Settings\Administrator>rman target /


8) Configure RMAN:

RMAN> set dbid 123456789
RMAN> startup nomount


9) Restore SPFILE:

RMAN> restore spfile from 'D:\EXPORT\RMAN\C-3648252040';

10) Startup database:

RMAN> startup force nomount;

11) Restore controlfile:

RMAN> restore controlfile from 'D:\EXPORT\RMAN\C-3648252040';
RMAN> shutdown;
RMAN> exit;

12) Proceed to restore and recovery:

RMAN> startup mount;
RMAN> shutdown immediate;
RMAN> startup mount;
 
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
RMAN> exit

Now you should have a completely recovered database!
Post a Comment