INTRODUCTION
The below steps will describe how to perform Rman Scratch.
STEP 1:
Take a RMAN full backup of the database
[oracle@Clone oradata]$ export ORACLE_SID=Product [oracle@Clone oradata]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Mon Jul 1 18:07:29 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
[oracle@Clone oradata]$ rman target /Recovery Manager: Release 12.2.0.1.0 – Production on Mon Jul 1 18:07:38 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRODUCT (DBID=1190102695)
RMAN> backup database plus archivelog;
Starting backup at 01-JUL-19
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=51 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=1 STAMP=1012500474
channel ORA_DISK_1: starting piece 1 at 01-JUL-19
channel ORA_DISK_1: finished piece 1 at 01-JUL-19
piece handle=/u01/app/oracle/fast_recovery_area/Product/PRODUCT/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180755_gkmzo3xw_.bkp tag=TAG20190701T180755 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 01-JUL-19
Starting backup at 01-JUL-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/Product/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/Product/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/Product/undotbs01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/Product/users01.dbf
channel ORA_DISK_1: starting piece 1 at 01-JUL-19
channel ORA_DISK_1: finished piece 1 at 01-JUL-19
piece handle=/u01/app/oracle/fast_recovery_area/Product/PRODUCT/backupset/2019_07_01/o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp tag=TAG20190701T180803 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:46
Finished backup at 01-JUL-19
Starting backup at 01-JUL-19
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=2 STAMP=1012500529
channel ORA_DISK_1: starting piece 1 at 01-JUL-19
channel ORA_DISK_1: finished piece 1 at 01-JUL-19
piece handle=/u01/app/oracle/fast_recovery_area/Product/PRODUCT/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp tag=TAG20190701T180849 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-JUL-19
Starting Control File and SPFILE Autobackup at 01-JUL-19
piece handle=/u01/app/oracle/fast_recovery_area/Product/PRODUCT/autobackup/2019_07_01/o1_mf_s_1012500530_gkmzpv76_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 01-JUL-19
RMAN>
STEP 2:
Move the backup set to the target server.
[oracle@Clone PRODUCT]$ scp -r autobackup/ backupset/ oracle@192.168.1.8:/u01/apporacle@192.168.1.8’s password:
o1_mf_s_1012500530_gkmzpv76_.bkp 100% 10MB 10.2MB/s 00:00
o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp 100% 1082MB 20.4MB/s 00:53
o1_mf_annnn_TAG20190701T180755_gkmzo3xw_.bkp 100% 151MB 18.9MB/s 00:08
o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp
100% 40KB 39.5KB/s 00:00
[oracle@Clone PRODUCT]$
STEP 3:
Start the database in nomount stage we will face an error of no parameter file.
[oracle@VM app]$ rman target /Recovery Manager: Release 12.2.0.1.0 – Production on Mon Jul 1 19:09:25 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set DBID=1190102695
executing command: SET DBID
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/12.2.0.1/db_1/dbs/initcdb1.ora’
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1073741824 bytes
Fixed Size 8628936 bytes
Variable Size 281019704 bytes
Database Buffers 780140544 bytes
Redo Buffers 3952640 bytes
RMAN>
STEP 4:
Restore the spfile from the backup
RMAN> restore spfile from ‘/u01/app/autobackup/2019_07_01/o1_mf_s_1012500530_gkmzpv76_.bkp’;
Starting restore at 01-JUL-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=8 device type=DISK
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/autobackup/2019_07_01/o1_mf_s_1012500530_gkmzpv76_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 01-JUL-19
RMAN>
STEP 5:
Shutdown and bring the database to nomount stage using the restored spfile.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 838860800 bytes
Fixed Size 8626240 bytes
Variable Size 629149632 bytes
Database Buffers 197132288 bytes
Redo Buffers 3952640 bytes
STEP 6:
Connect to RMAN and restore the controlfile from the backup and bring the database to mount stage,
SQL> !rman target /
Recovery Manager: Release 12.2.0.1.0 – Production on Mon Jul 1 19:36:52 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: PRODUCT (not mounted)
RMAN> restore controlfile from ‘/u01/app/autobackup/2019_07_01/o1_mf_s_1012500530_gkmzpv76_.bkp’;
Starting restore at 01-JUL-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=36 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/Product/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/Product/control02.ctl
Finished restore at 01-JUL-19
RMAN> alter database mount;
Statement processed
released channel: ORA_DISK_1
NOTE:When we tried to restore the database, we faced the below error. We need to catalog the datafiles backup. Indication to the RMAN the location of datafiles backup.
RMAN> restore database;
Starting restore at 01-JUL-19
Starting implicit crosscheck backup at 01-JUL-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=42 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 01-JUL-19
Starting implicit crosscheck copy at 01-JUL-19
using channel ORA_DISK_1
Finished implicit crosscheck copy at 01-JUL-19
searching for all files in the recovery area
cataloging files…
no files cataloged
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/01/2019 19:40:00
RMAN-06026: some targets not found – aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
STEP 7:
Catalog the location of datafile backup.
RMAN> catalog start with ‘/u01/app/backupset’;
searching for all files that match the pattern /u01/app/backupset
List of Files Unknown to the Database
=====================================
File Name: /u01/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp
File Name: /u01/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180755_gkmzo3xw_.bkp
File Name: /u01/app/backupset/2019_07_01/o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp
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/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp
File Name: /u01/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180755_gkmzo3xw_.bkp
File Name: /u01/app/backupset/2019_07_01/o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp
STEP 8:
Restore and recover the database,
RMAN> restore database;
Starting restore at 01-JUL-19
using channel ORA_DISK_1
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/Product/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/Product/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/Product/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/Product/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backupset/2019_07_01/o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp
channel ORA_DISK_1: piece handle=/u01/app/backupset/2019_07_01/o1_mf_nnndf_TAG20190701T180803_gkmzodq0_.bkp tag=TAG20190701T180803
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:26
Finished restore at 01-JUL-19
RMAN> recover database;
Starting recover at 01-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=2
channel ORA_DISK_1: reading from backup piece /u01/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp
channel ORA_DISK_1: piece handle=/u01/app/backupset/2019_07_01/o1_mf_annnn_TAG20190701T180849_gkmzpsj1_.bkp tag=TAG20190701T180849
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/fast_recovery_area/Product/PRODUCT/archivelog/2019_07_01/o1_mf_1_2_gkn57pyy_.arc thread=1 sequence=2
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/Product/PRODUCT/archivelog/2019_07_01/o1_mf_1_2_gkn57pyy_.arc RECID=3 STAMP=1012506191
unable to find archived log
archived log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/01/2019 19:43:12
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1423052
RMAN> alter database open resetlogs;
Statement processed
RMAN>
RMAN> select name, open_mode from v$database;
NAME OPEN_MODE
——— ——————–
PRODUCT READ WRITE
RMAN>