Restore and recover a database when datafiles are awol

A sysadmin wasn’t paying attention and deleted a few datafile from the (running) database. What can we do? Actually we will do the same as here.

  1. Startup database in mount mode
  2. Restore the database
  3. Recover the database
  4. Open the database
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=434 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/uevdpcfd_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/uevdpcfd_1_1 tag=TAG20201024T143421
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
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/ufvdpcgq_1_1
channel ORA_DISK_1: piece handle=/u04/backups/bloemkool/ufvdpcgq_1_1 tag=TAG20201024T143421
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 24-OCT-20

RMAN> recover database;

Starting recover at 24-OCT-20
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 24-OCT-20

RMAN> alter database open;

Statement processed

RMAN>

pffff….that was easy.

Leave a Reply

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