Restore the database from production backup
Start the database nomount stage
sqlplus / as sysdba
SQL> startup nomount pfile=’<location>/initPROD.ora’;
rman target /
RMAN>restore controlfile from '/u02/prod_backup/prod_Control_Copy.ctl';
RMAN>alter database mount;
RMAN>catalog start with '/u02/prod_backup/';
RMAN>CONFIGURE CHANNEL DEVICE TYPE DISK clear; - This will clear the disk type from production RMAN configurations
RMAN>restore database preview;
Restoration Script:
run {
set newname for database to '/u01/oracle/test/db/data/%U';
set until scn 8854465393;
restore database;
SWITCH DATAFILE ALL;
recover database;
}
Rename the redo log files:
alter database rename file '/u01/oracle/prod/db/data/log05.dbf' to '/u01/oracle/test/db/data/log01.log';
alter database rename file '/u01/oracle/prod/db/data/log06.dbf' to '/u01/oracle/test/db/data/log02.log';
alter database rename file '/u01/oracle/prod/db/data/log07.dbf' to '/u01/oracle/test/db/data/log03.log';
alter database rename file '/u01/oracle/prod/db/data/log08.dbf' to '/u01/oracle/test/db/data/log04.log';
alter database clear unarchived logfile group 8;
Rename the tempfile:
alter database rename file '/u01/oracle/prod/db/data/temp01.dbf' to '/u01/oracle/test/db/data/temp01.dbf';
Create pfile
Change the database name to TEST
$nid target=sys/<sys_password> dbname=TEST
Rename the pfile to initTEST.ora
Change the database name to TEST
Start the database in nomount and create spfile.
Bounce the database
Start the database nomount stage
sqlplus / as sysdba
SQL> startup nomount pfile=’<location>/initPROD.ora’;
rman target /
RMAN>restore controlfile from '/u02/prod_backup/prod_Control_Copy.ctl';
RMAN>alter database mount;
RMAN>catalog start with '/u02/prod_backup/';
RMAN>CONFIGURE CHANNEL DEVICE TYPE DISK clear; - This will clear the disk type from production RMAN configurations
RMAN>restore database preview;
Restoration Script:
run {
set newname for database to '/u01/oracle/test/db/data/%U';
set until scn 8854465393;
restore database;
SWITCH DATAFILE ALL;
recover database;
}
Rename the redo log files:
alter database rename file '/u01/oracle/prod/db/data/log05.dbf' to '/u01/oracle/test/db/data/log01.log';
alter database rename file '/u01/oracle/prod/db/data/log06.dbf' to '/u01/oracle/test/db/data/log02.log';
alter database rename file '/u01/oracle/prod/db/data/log07.dbf' to '/u01/oracle/test/db/data/log03.log';
alter database rename file '/u01/oracle/prod/db/data/log08.dbf' to '/u01/oracle/test/db/data/log04.log';
alter database clear unarchived logfile group 8;
Rename the tempfile:
alter database rename file '/u01/oracle/prod/db/data/temp01.dbf' to '/u01/oracle/test/db/data/temp01.dbf';
Create pfile
Change the database name to TEST
$nid target=sys/<sys_password> dbname=TEST
Rename the pfile to initTEST.ora
Change the database name to TEST
Start the database in nomount and create spfile.
Bounce the database
No comments:
Post a Comment