Full Restore - Linux

 

 

A full restore is something to be done ONLY after all other options have been exhausted, because there will be loss of data.

Starting Point

The starting point is that the entire database is either deleted or corrupted, but the basic directory structure is in place:

admin/$ORACLE_SID
FRA/$ORACLE_SID
oradata/$ORACLE_SID/controlfile
oradata/$ORACLE_SID/datafile
oradata/$ORACLE_SID/onlinelog

In the directory backup/logs you can find the log from the last backup:


Find DBID of Database

From that logfile, you can find the start of the last backup, where you can find the DBID of the database.

In this case the ORACLE_SID is CDRATOR and the DBID is 20141184369.

Find SPFILE Backup

In the logfile, at the very end, the name of backup file holding the SPFILE is found.

Find Control File Backup

In the logfile, in the section above, the name of the backup file holding the CONTROLFILE is found.

On the line below the file name is the SCN (System Change Number). In this example a bit covered but readable as 10825040684713.

Adviced to use the last sequence number instead of SCN as in the image below (last sequence from the last archive log file):

Restore SPFILE from Backup

The following commands shall be executed:

SH> export ORACLE_SID=CDRATOR
SH> cd $ORACLE_BASE/backup/$ORACLE_SID
SH> rman target /
RMAN> set dbid=20141184369;
RMAN> startup nomount;
RMAN> restore spfile from '/opt/oracle/backup/CDRATOR/20170328-ARCH-l4s08qf6_1_1';
RMAN> shutdown immediate;

Restore Control File from Backup

RMAN> set dbid=20141184369;
RMAN> startup nomount;
RMAN> restore controlfile from '/opt/oracle/backup/CDRATOR/20170328-ARCH-l3s08qf2_1_1';
RMAN> shutdown immediate;

Catalog Backup Files

RMAN> set dbid=20141184369;
RMAN> startup mount;
RMAN> catalog start with '/opt/oracle/backup/CDRATOR/' noprompt;

Start Restore/Recover Operation

RMAN> configure device type disk parallelism 8;
RMAN> run {
2> set until SCN 10825040684713;
3> restore database;
4> recover database;
5> }

And now there is time for one or more cups of coffee (wink) !!!!

Open Database

If the restore and recover completed without any warnings and errors, you can open the database.

RMAN> alter database open resetlog;

OBS!!!

For restoring on a different server, we must run the following command 3 times BEFORE the backup starts:

alter system switch logfile;
alter system switch logfile;
alter system switch logfile;