Restore and recover a database as far as we can go

Something went wrong…we need the database back to the point we have archivelogs of:

  1. List incarnation (just to see what we have…no actual need to)
  2. Restore database (getting the datafiles back in place)
  3. Recover database (creating an actual working database with all updates we can possibly find in the archives)
  4. Open the database (and start working again)
RMAN> list incarnation;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       CDB01    1590200411       PARENT  1          17-APR-19
2       2       CDB01    1590200411       CURRENT 1920977    07-OCT-20

RMAN> startup force mount;

Oracle instance started
database mounted

Total System Global Area     620756648 bytes

Fixed Size                     9137832 bytes
Variable Size                339738624 bytes
Database Buffers             268435456 bytes
Redo Buffers                   3444736 bytes

RMAN> restore database;

Starting restore at 24-OCT-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=441 device type=DISK

skipping datafile 5; already restored to file /u02/datafiles/CDB01/pdbseed/system01.dbf
skipping datafile 6; already restored to file /u02/datafiles/CDB01/pdbseed/sysaux01.dbf
skipping datafile 8; already restored to file /u02/datafiles/CDB01/pdbseed/undotbs01.dbf
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 /u02/datafiles/CDB01/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u02/datafiles/CDB01/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u02/datafiles/CDB01/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u02/datafiles/CDB01/users01.dbf
channel ORA_DISK_1: reading from backup piece /u04/backups/bloemkool/tuvdp87q_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/tuvdp87q_1_1 tag=TAG20201024T132202
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
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 00009 to /u02/datafiles/CDB01/PDB01/system01.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u02/datafiles/CDB01/PDB01/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00011 to /u02/datafiles/CDB01/PDB01/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u02/datafiles/CDB01/PDB01/users01.dbf
channel ORA_DISK_1: restoring datafile 00013 to /u02/datafiles/CDB01/PDB01/martijn01.dnf
channel ORA_DISK_1: reading from backup piece /u04/backups/bloemkool/tvvdp898_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/tvvdp898_1_1 tag=TAG20201024T132202
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
Finished restore at 24-OCT-20

RMAN> recover database;

Starting recover at 24-OCT-20
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 2144 is already on disk as file /u03/archiving/CDB01/1_2144_1053215134.dbf
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=2140
channel ORA_DISK_1: reading from backup piece /u04/backups/bloemkool/u1vdp8a7_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/u1vdp8a7_1_1 tag=TAG20201024T132319
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u03/archiving/CDB01/1_2140_1053215134.dbf thread=1 sequence=2140
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=2141
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=2142
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=2143
channel ORA_DISK_1: reading from backup piece /u04/backups/bloemkool/u3vdp8n3_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/u3vdp8n3_1_1 tag=TAG20201024T133011
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u03/archiving/CDB01/1_2141_1053215134.dbf thread=1 sequence=2141
archived log file name=/u03/archiving/CDB01/1_2142_1053215134.dbf thread=1 sequence=2142
media recovery complete, elapsed time: 00:00:03
Finished recover at 24-OCT-20

RMAN> alter database open;

Statement processed

RMAN>

There, your database is back, up to the point until we have archivelogs.

Leave a Reply

Your email address will not be published. Required fields are marked *