Thursday, April 22, 2010

Restore and recovery of new database using rman backup (controlfile backup).

· Backups are taken using controlfile.
· The refresh is from PROD to DEV database as of 31st Dec 2009.
· We are not going to connect to Production DB or server (This will be an advantage).
· We use 30th Dec 2009 controlfile to restore DB as 31st Dec 2009 controlfile is lost.
· FYI. Production and Development are in different servers.

Backup Location in:-

Prod is /u22/MAX/ora_flash_area/MAXPRD
Dev is /u01/u22/MAX/ora_flash_area/MAXPRD (copied from Production server)

In Development Server
1. Export production SID
$ export ORACLE_SID=MAXPRD ß-Production SID this is throughout the process till NID utility used.

2. Change the DB name in init.ora and also rename init.ora to match Production.
db_name=MAXDEV to db_name=MAXPRD
initMAXDEV.ora to initMAXPRD.ora

3. startup nomount instance on a new server (here it is Dev)

SQL>startup nomount;
4. Restore the controlfile from the backup restored at dev server.
$ rman target /
RMAN>restore controlfile from '/u01/u22/MAX/ora_flash_area/MAXPRD/autobackup/2009_12_30/o1_mf_s_707002930_5mpp5n5z_.bkp’

RMAN>switch database to copy;

run
{ set until time "to_date( '31-12-2009 21:57', 'DD-MM-RRRR HH24:MI')";
recover database;

}
5. Actually, need to rename the online redolog files before opening the database in case the production path of redo log files is different from Development (in this case yes).

SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u12/oraprod/MAXPRDdata/logMAXPRD6a.dbf
/u14/oraprod/MAXPRDdata/logMAXPRD6b.dbf
/u14/oraprod/MAXPRDdata/stdbylog1
…..
…..
SQL> alter database rename file '/u12/oraprod/MAXPRDdata/logMAXPRD6a.dbf' to '/u01/oramax/maxdevdata/logMAXPRD6a.dbf'; ß-location in Development server.

Database altered.
Do it for all the files seen above..


6. Drop and Add temp tablespace.
SQL> ALTER DATABASE TEMPFILE '/u12/oraprod/MAXPRDdata/temp01.dbf' DROP;

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/oramax/maxdevdata/temp01.dbf' SIZE 3000M REUSE AUTOEXTEND OFF;

7. Open database

Sql> alter database open resetlogs;

8. Once DB is open use below NID utility to rename the database as required & also the DBID.

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
$ nid TARGET=sys/manager DBNAME=MAXDEV
( DB will shutdown itself).

9. change DB Name in init.ora
db_name= MAXPRD to db_name= MAXDEV
initMAXPRD.ora to initMAXDEV.ora

10. Export development SID
$ export ORACLE_SID=MAXDEV

11. Open Database now ad Development

SQL> alter database open;



12. Start the listener
lsnrctl start MAXDEV.


Please comment if any concerns in the steps posted.
Shekhar

No comments:

Post a Comment