Hi,
I will tell you about the RMAN (Recovery Manager) tool that we use frequently Backup and Restore operations in Oracle Databases in this third article of my tutorial series.
Read my rman backup tutorial series before this article with following links. We will use these backups in this restore recover tutorial series.
https://ittutorial.org/2019/03/27/oracle-rman-recovery-manager-backup-tutorials-8/
then read first article of this tutorial series with following link.
https://ittutorial.org/2019/03/28/oracle-rman-recovery-manager-restore-recover-tutorials-1/
https://ittutorial.org/2019/03/28/oracle-rman-recovery-manager-restore-recover-tutorials-2/
Thirdly you should restore database from backup;
RMAN> restore database; Starting restore at 26-MAR-19 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=36 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 /oradata/19c/DEVECI19C/system01.dbf channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_0rttc45u_27_20190326.bkp channel ORA_DISK_1: piece handle=/u01/backup/FULL_DEVECI19_0rttc45u_27_20190326.bkp tag=TAG20190326T005213 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:55 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 00003 to /oradata/19c/DEVECI19C/sysaux01.dbf channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_0sttc45u_28_20190326.bkp channel ORA_DISK_1: piece handle=/u01/backup/FULL_DEVECI19_0sttc45u_28_20190326.bkp tag=TAG20190326T005213 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:15 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 00004 to /oradata/19c/DEVECI19C/undotbs01.dbf channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_0tttc45u_29_20190326.bkp channel ORA_DISK_1: piece handle=/u01/backup/FULL_DEVECI19_0tttc45u_29_20190326.bkp tag=TAG20190326T005213 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 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 00007 to /oradata/19c/DEVECI19C/users01.dbf channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_0uttc45u_30_20190326.bkp channel ORA_DISK_1: piece handle=/u01/backup/FULL_DEVECI19_0uttc45u_30_20190326.bkp tag=TAG20190326T005213 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 26-MAR-19 RMAN>
Datafiles are restored now we need to restore archivelogs fourthly.
RMAN> restore archivelog all; Starting restore at 26-MAR-19 using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log restore to default destination channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=3 channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=4 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: restoring archived log archived log thread=1 sequence=7 channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=8 channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=9 channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_1ettcqar_46_20190326.bkp channel ORA_DISK_1: errors found reading piece handle=/u01/backup/FULL_DEVECI19_1ettcqar_46_20190326.bkp channel ORA_DISK_1: failover to piece handle=/u01/backup/FULL_DEVECI19_1ettcqar_46_20190326.rman tag=TAG20190326T071018 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting archived log restore to default destination channel ORA_DISK_1: restoring archived log archived log thread=1 sequence=10 channel ORA_DISK_1: reading from backup piece /u01/backup/FULL_DEVECI19_1httcqdo_49_20190326.bkp channel ORA_DISK_1: errors found reading piece handle=/u01/backup/FULL_DEVECI19_1httcqdo_49_20190326.bkp channel ORA_DISK_1: failover to piece handle=/u01/backup/FULL_DEVECI19_1httcqdo_49_20190326.rman tag=TAG20190326T071152 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 26-MAR-19 RMAN>
Now we need to recover database from archivelogs with following.
RMAN> recover database; Starting recover at 26-MAR-19 using channel ORA_DISK_1 starting media recovery archived log for thread 1 with sequence 5 is already on disk as file /oradata/install/dbs/arch1_5_1001759193.dbf archived log for thread 1 with sequence 6 is already on disk as file /oradata/install/dbs/arch1_6_1001759193.dbf archived log for thread 1 with sequence 7 is already on disk as file /oradata/install/dbs/arch1_7_1001759193.dbf archived log for thread 1 with sequence 8 is already on disk as file /oradata/install/dbs/arch1_8_1001759193.dbf archived log for thread 1 with sequence 9 is already on disk as file /oradata/install/dbs/arch1_9_1001759193.dbf archived log for thread 1 with sequence 10 is already on disk as file /oradata/install/dbs/arch1_10_1001759193.dbf archived log file name=/oradata/install/dbs/arch1_5_1001759193.dbf thread=1 sequence=5 archived log file name=/oradata/install/dbs/arch1_6_1001759193.dbf thread=1 sequence=6 archived log file name=/oradata/install/dbs/arch1_7_1001759193.dbf thread=1 sequence=7 archived log file name=/oradata/install/dbs/arch1_8_1001759193.dbf thread=1 sequence=8 archived log file name=/oradata/install/dbs/arch1_9_1001759193.dbf thread=1 sequence=9 archived log file name=/oradata/install/dbs/arch1_10_1001759193.dbf thread=1 sequence=10
media recovery complete, elapsed time: 00:00:00 Finished recover at 26-MAR-19
Finally we should open database with resetlogs like following.
[oracle@MehmetSalih backup]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Mar 26 08:14:45 2019 Version 19.2.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.2.0.0.0 SQL> alter database open resetlogs; Database altered. SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE SQL>
Do you want to learn Oracle Database for Beginners, then read the following articles.
https://ittutorial.org/oracle-database-19c-tutorials-for-beginners/