Description:-
As part of disaster recovery exercise or to test the validity of a RMAN backup, a full restore and recovery of databases can be performed on scratch or test servers utilizing the production RMAN backups which have been restored from the tape backups on these test or scratch servers.
The following assumptions are made in this note:
- The RMAN backups have been restored from disk backups to the same backup location on the new server as the production server where the backup was originally taken suppose the backup taken on the production server location:/u01/app/oracle/product/19.0.0/dbhome_1/dbs/ then create the same folder on the new server and copy the backup on the new server on the same location.
- Consider the identical directory structure of production has been created on the new server such as the database files (data, control files, redo log files), bdump, cdump, udump and adump locations etc.
- Controlfile autobackup must be enabled.
Steps required to restore the backup of a production database on a backup server:-
- Restore the spfile from the autobackup
- Restore the controlfile from the autobackup
- Restore database
- Recover the database
- Open the database with resetlogs
WE HAVE THE BACKUP OF PROD SERVER AND WE HAVE TO RESTORE IT IN ANOTHER SERVER.
Restore the spfile from autobackup in RMAN :
————————————————————–
[oracle@ram ~]$ export ORACLE_SID=dbwr
[oracle@ram ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 – Production on Mon Jul 22 12:05:31 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> !rman target /
Recovery Manager: Release 19.0.0.0.0 – Production on Mon Jul 22 12:05:39 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set DBID=3576090905
executing command: SET DBID
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initdbwr.ora’
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1073737800 bytes
Fixed Size 8904776 bytes
Variable Size 276824064 bytes
Database Buffers 784334848 bytes
Redo Buffers 3674112 bytes
RESTORE THE SPFILE FROM BACKUP :
——————————————————-
RMAN> restore spfile from ‘/u01/backup/sp05u4o0rt_1_1’;
Starting restore at 22-JUL-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/backup/sp05u4o0rt_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 22-JUL-19
RMAN>
SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.
START WITH THE NEW SPFILE :
—————————
SQL> startup nomount
ORACLE instance started.
Total System Global Area 243268216 bytes
Fixed Size 8895096 bytes
Variable Size 180355072 bytes
Database Buffers 50331648 bytes
Redo Buffers 3686400 bytes
SQL>
RESTORE THE CONTROLFILE FROM BACKUP AND MOUNT THE DATABASE :
————————————————————————————————————
SQL> !rman target /
Recovery Manager: Release 19.0.0.0.0 – Production on Mon Jul 22 12:12:05 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: DBWR(not mounted)
RMAN> restore controlfile from ‘/u01/backup/cont03u4o0r5_1_1’;
Starting restore at 22-JUL-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/DBWR/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/DBWR/control02.ctl
Finished restore at 22-JUL-19
RMAN> alter database mount;
released channel: ORA_DISK_1
Statement processed
RMAN> catalog start with ‘/u01/backup’;
searching for all files that match the pattern /u01/backup
List of Files Unknown to the Database
=====================================
File Name: /u01/backup/full01u4o0mi_1_1
File Name: /u01/backup/cont03u4o0r5_1_1
File Name: /u01/backup/sp05u4o0rt_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files…
cataloging done
List of Cataloged Files
=======================
File Name: /u01/backup/full01u4o0mi_1_1
File Name: /u01/backup/cont03u4o0r5_1_1
File Name: /u01/backup/sp05u4o0rt_1_1
RMAN>
RESTORE THE DATABASE USING THE BACKUP :
——————————————————————–
RMAN> restore database;
Starting restore at 22-JUL-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DBWR/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DBWR/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DBWR/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/DBWR/Mon01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/DBWR/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/full01u4o0mi_1_1
channel ORA_DISK_1: errors found reading piece handle=/u01/full01u4o0mi_1_1
channel ORA_DISK_1: failover to piece handle=/u01/backup/full01u4o0mi_1_1 tag=TAG20190622T120018
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 22-JUL-19
RMAN>
RECOVER THE DATABASE :
——————————————-
It will show the archive log error
The sequence is missing.
There is enough logs are applied it will be waits for another sequence.
It will be corrected by taking the backup of archivelog and recover it
RMAN> recover database;
Starting recover at 22-JUL-19
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
channel ORA_DISK_1: reading from backup piece /u01/backup/arch09u4o23c_1_1
channel ORA_DISK_1: piece handle=/u01/backup/arch09u4o23c_1_1 tag=TAG20190622T122412
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_5_1011610655.dbf thread=1 sequence=5
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_6_1011610655.dbf thread=1 sequence=6
unable to find archived log
archived log thread=1 sequence=7
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/22/2019 12:26:38
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 7 and starting SCN of 2085222
RMAN>
OPEN THE DATABASE USING RESETLOGS :
————————————————————
SQL> alter database open resetlogs;
Database altered.
Catch Me On:- Hariprasath Rajaram
Telegram:https://t.me/joinchat/I_f4DhGF_Zifr9YZvvMkRg
LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/
Facebook:https://www.facebook.com/HariPrasathdba
FB Group:https://www.facebook.com/groups/894402327369506/
FB Page: https://www.facebook.com/dbahariprasath/?
Twitter: https://twitter.com/hariprasathdba