Download PDF
Step 1 : Parameter Files not Exist its fresh RMAN Backup Restore on New Environment
export ORACLE_SID = mydb1
rman target /
startup nomount;
Restore spfile from '/backup/backup/c-1680948073-20210520-00';
exit
sqlplus / as sysdba
create pfile from spfile;
Change Required Parameters File in Oracle Home dbs (Linux) or Database (Windows) Folder "initmydb1.ora"
After Performed Changes in New Pfile execute below Steps
sqlplus / as sysdba
shutdown immediate;
startup nomount;
create spfile from Pfile;
shutdown immediate;
startup nomount;
Step 2 : Restore Control file
rman target /
restore controlfile from '/backup/backup/master_200521/c-1680948073-20210520-00';
alter database mount;
Step 3 : Catalog Backup
rman target /
Crosscheck backup;
noprompt delete expired backup;
catalog start with '/backup/backup';
Step 4 : Create script of Restore
If you want to restore on Non ASM File System and New File System of Data file below statement will generate Script and then you need to Change the Path
sqlplus / as sysdba
set linesize 1000
set pagesize 10000
select 'SET NEWNAME FOR DATAFILE ' || file# || ' TO ' || '''' || name || '''' || ';' from v$datafile;
Restore Scripts
mkdir /backup/logs
mkdir /backup/scripts
vi /backup/scripts/rman_restore.sh
export ORACLE_SID=mydb
export ORACLE_HOME=/u01/app/oracle/19.2.0/db_home1/
export PATH = $PATH:$ORACLE_HOME
rman target / LOG='/backup/logs/rman_restore.log' <<EOF
run{
SET NEWNAME FOR DATAFILE 1 TO '/data/database/mydb/o1_mf_system_lvpwl674_.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/data/database/mydb/CISTS_01_1.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/data/database/mydb/o1_mf_sysaux_lvpwnvoc_.dbf';restore database;
SWITCH DATAFILE ALL;
Recover database;
}
exit;
EOF
Step 5 : Execute Restore
Check Incarnation of Database it should be same as database which backup you are restoring
rman target /
list incarnation of database;
If not Same then change Incarnation
rman target /
RESET DATABASE TO INCARNATION 2;
nohup sh /backup/scripts/rman_restore.sh &
Step 6 : Monitoring RMAN
sqlplus / as sysdba
SELECT round(( ( ( sofar ) / (totalwork) ) *100) ,10) "% Complete" FROM v$session_longops WHERE opname LIKE 'RMAN%'
AND opname NOT LIKE '%aggregate%'
AND totalwork != 0;
tail -f /backup/logs/rman_restore.log
Step 7 : Recover Database
If Required to Restore Specific Archive Files (If Restore Database Complete but Error in Recovery no any archive Restore and Recover)
rman target /
restore archivelog from sequence 72457 until sequence 72475 thread 1;
restore archivelog from sequence 72527 until sequence 72545 thread 2;
recover database;
or
sqlplus / as sysdba
recover database using backup control file until cancel;
enter "auto"
Step 8 : Change File Location
Change Temp File and Redo Log File Path Before Opening Database by using SQL Script.
sqlplus / as sysdba
select 'Alter database rename file ' || '''' || member || '''' || ' to ' || '''' || member || '''' || ';' from v$logfile;
select 'Alter database rename file ' || '''' || name || '''' || ' to ' || '''' || name || '''' || ';' from v$tempfile;
Alter database rename file '+PDATA/T24PRODDB/ONLINELOG/group_64.838.1080826843' to '+DATA/T24STG/ONLINELOG/group_64.838.1080826843';
alter database rename file '+DATA/T24STG/B34E68EABF0501A0E0530AAC15194891/TEMPFILE/temp.864.1069657275' to '+PDATA/T24PRODDB/B34E68EABF0501A0E0530AAC15194891/TEMPFILE/temp.864.1069657275';
Step 9 : Open Database in Reset Logs
recover database using backup controlfile until cancel;
alter database open resetlogs;
shutdown immediate;
startup nomount;
if using wallet open wallet
alter database mount;
alter database open;
Step 10 : Disable RAC node if RAC to Single Database
sqlplus / as sysdba
alter database enable thread 2;
Step 11 : If using Container Databases
sqlplus / as sysdba
ALTER PLUGGABLE DATABASE all open;
ALTER PLUGGABLE DATABASE ALL SAVE STATE;
Step 12 : Check and Create temporary Tablespace
sqlplus / as sysdba
SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME = 'DEFAULT_TEMP_TABLESPACE';
CREATE TEMPORARY TABLESPACE TEMP_02 TEMPFILE '/data/database/t24stgdr3/temp_02.dbf' SIZE 500m autoextend on next 10m maxsize unlimited;
