DATABASE RESTORATION FROM RMAN BACKUP
Step-1:
Create or copy or restore the pfile in destination server $ORACLE_HOME/dbs path. Make all necessary changes.
Step-2:
Create all necessary paths mentioned in pfile.
Login as grid user
su - grid
export ORACLE_SID=+ASM1
asmcmd
Create paths.
Step-3:
Export necessary environmental variables. ORACLE_SID should be the instance_name mentioned in pfile of the database you are going to restore.
export ORACLE_SID=jems1
export ORACLE_HOME=’/u03/app/oracle/11.2.0/dbhome_1’
export ORACLE_BASE= '/u03/app/oracle'
Step-4:
Start the database in nomount mode.
Sqlplus / as sysdba
STARTUP NOMOUNT;
Step-5:
Connect rman with catalog database and set dbid. And restore the control file.
rman target / catalog rman_rac/rman_rac@rmandb
RMAN> SET DBID=2014928958;
run {
allocate channel dev_0 type 'sbt_tape'
parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore controlfile from tag='TAG20150201T224552';
release channel dev_0;
}
Step-6:
Mount the database with controlfiles.
SQL> alter database mount;
Database altered.
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
jems MOUNTED
Step-7:
(Please don’t use recovery catalog here)
rman target /
Restore the database:
Please choose and implement any of the below two options to restore the jems Database Backup:
Option 1:
RMAN>
set DBID=2014928958;
run {
allocate channel dev_0 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
allocate channel dev_1 type 'sbt_tape' parms
'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
SET NEWNAME FOR DATABASE TO '+TESTING/%U';
restore database from tag='TAG20150201T224552';
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
After restore and recover database (i.e before open resetlog) you can do this to rename redolog. Just query member column of v$logfile and issue "alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs' ;
LOGFILES
------------------------------
+DATA/jems/logfile/redo1a
+DATA/jems/logfile/redo2a
+DATA/jems/logfile/redo3a
+DATA/jems/logfile/redo4a.log
+DATA/jems/logfile/redo5a.log
+DATA/jems/logfile/redo6a.log
alter database rename file '+DATA/jems/logfile/redo1a' to '+TESTING/jems/logfile/redo1a';
alter database rename file '+DATA/jems/logfile/redo2a' to '+TESTING/jems/logfile/redo2a';
alter database rename file '+DATA/jems/logfile/redo3a' to '+TESTING/jems/logfile/redo3a';
alter database rename file '+DATA/jems/logfile/redo4a.log' to '+TESTING/jems/logfile/redo4a.log';
alter database rename file '+DATA/jems/logfile/redo5a.log' to '+TESTING/jems/logfile/redo5a.log';
alter database rename file '+DATA/jems/logfile/redo6a.log' to '+TESTING/jems/logfile/redo6a.log';
Option 2:
set path in parameter file of instance.
Set below parameter in target database init/spfile. << DB Restoration site.
LOG_FILE_NAME_CONVERT='datafile old disk group name','New diskgroup name'
LOG_FILE_NAME_CONVERT='redo old disk group name','New diskgroup name'
set below parameter in pfile & restart instance to mount mode.
DB_FILE_NAME_CONVERT='+DATA',’ +TESTING’
LOG_FILE_NAME_CONVERT='+DATA',’+ TESTING’
Verify parameters are set or not.
Use below script to restore database.
RMAN>
set DBID=2014928958;
run {
allocate channel dev_0 type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=website1,OB2BARHOSTNAME=myinslggnsbidb6.in.money.ge.com,OB2BARLIST=Website_DB6)';
'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore database from tag='TAG20150201T224552';
}
Step-8:
Restore archives:
run {
allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore archivelog sequence 49523 thread 1 from tag 'TAG20150201T224552';
release channel 'dev_0';
}
run {
allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore archivelog sequence between 49295 and 49296 thread 2 from tag 'TAG20150201T224552';
release channel 'dev_0';
}
run {
allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore archivelog sequence between 49524 and 50007 thread 1 from tag 'TAG20150201T232557';
release channel 'dev_0';
}
run {
allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=jems,OB2BARHOSTNAME=myinslggnsbidb1.in.money.ge.com,OB2BARLIST=jems_DB1_Monthly)';
restore archivelog sequence between 49297 and 49779 thread 2 from tag 'TAG20150201T232557';
release channel 'dev_0';
}
Step-9:
Recover the restored database:
RMAN> RECOVER DATABASE;
After restore and recover database (i.e before open resetlog) you can do this to rename redolog. Just query member column of v$logfile and issue "alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs' ;
LOGFILES
------------------------------
+DATA/jems/logfile/redo1a
+DATA/jems/logfile/redo2a
+DATA/jems/logfile/redo3a
+DATA/jems/logfile/redo4a.log
+DATA/jems/logfile/redo5a.log
+DATA/jems/logfile/redo6a.log
alter database rename file '+DATA/jems/logfile/redo1a' to '+TESTING/jems/logfile/redo1a';
alter database rename file '+DATA/jems/logfile/redo2a' to '+TESTING/jems/logfile/redo2a';
alter database rename file '+DATA/jems/logfile/redo3a' to '+TESTING/jems/logfile/redo3a';
alter database rename file '+DATA/jems/logfile/redo4a.log' to '+TESTING/jems/logfile/redo4a.log';
alter database rename file '+DATA/jems/logfile/redo5a.log' to '+TESTING/jems/logfile/redo5a.log';
alter database rename file '+DATA/jems/logfile/redo6a.log' to '+TESTING/jems/logfile/redo6a.log';
Step-10:
ALTER DATABASE OPEN RESETLOGS;
Very useful...Thanks for sharing
ReplyDelete