In my previous post I write about Oracle RMAN Backup, now I will explain a little bit about RMAN Recovery, there are many ways of using RMAN tools, but this is the way that i found to be succesfull.
Like I told you in my previous scenario I have a backup file that is copied to an NFS server from a tape server. The secondary server is also a running Oracle server that has its own instance that is being used. So my workaround for this recovery on a running Oracle server is to create a new Operating System user that is a member of oinstall and dba group, then create a new project on that user, so that the memory allocation is sufficient for the old and the recovered instance. For more detail you can see my next post on installing Oracle on Solaris.
To start recovery process connect to your secondary server with newly created oracle user, then start to type several initialization OS parameter that will be used to start rman
The first parameter is to set ORACLE_SID from the primary server, in my case I want to restore into the same ORACLE_SID and DBID. The second parameter is to set the required SGA for RMAN to start DUMMY instance. Now we can start to rman
rman target / nocatalog;
With the above script it will start a dummy instance/database with DBID and ORACLE_SID is the same as the one in primary database or the database that will be recovered. To know DBID in primary server just type
select DBID from v$database;
Or you can see from the backup file for controlfile, as I told you in my previous post about %F backup format.
Before continuing the recovery process you need to create same folder structure as the one in primary server. If you want to do recovery in different folder structure there will be some changes that is quite complicated. I choose to create the same folder structure. In creating folder for recovery process make sure that the ownership of those folder are belong to oracle user and group, so that oracle can access the folder.
Now back to rman console, type
RESTORE SPFILE TO PFILE ‘/ORACLE/HOME/DBS/INITDBTEST.ORA’ FROM ‘/BACKUP/PATH/CONTROLFILE’;
This will recover the SPFILE the to be recovered database into a PFILE that will be placed in the secondary database dbs folder, where PFILE used to be existed. Then edit the location specific parameters in PFILE. You need to note that location parameter is important you need to specify where dump file is, control file is, archivelog file is exist. Start the instance by executing this command.
STARTUP FORCE NOMOUNT PFILE=’/ORACLE/HOME/DBS/INITDBTEST.ORA’;
RESTORE CONTROLFILE FROM ‘/BACKUP/PATH/CONTROLFILE;
ALTER DATABASE MOUNT;
The second command is to restore control file to the destination of control file that is specified in PFILE that has just been recovered. The third command is to mount the database. The next step is to restore the database from the rman backup file, it can be done by executing this command
After restoring the database file, we need to recover the database so that it can be opened, it can be done by executing this command
RECOVER DATABASE NOREDO;
This command will recover the database without using any archivelog, next is to open the database and it can be done by typing
ALTER DATABASE OPEN RESETLOGS;
Then don’t forget to create new tnsname in the secondary oracle server so that it can be used.