Sie sind auf Seite 1von 2

RMAN Recovery when everything is lost.

In this scenario all you have is the RMAN backup and RMAN control file backup on the SAN in the two
directories, where DBSID is your database SID.
 /home/oracle/backup/prod/DBSID/ctlfile
 /home/oracle/backup/prod/DBSID/backupset
Restrictions:
 It is not possible at any release to restore an init.ora file from a backuppiece as init.ora files are
never included in a backup. So create a simple one for mounting purposes.
 The dbid of the target database must be known. E.g. DBID= 3812578829

In this example RMAN assumes that the same file structure is available (if not you have to map each file
from the old location to the new location) so the first thing we do is to create the same file structure for data
and index files, redo and the admin folders (bdump…).

mkdir /home/oracle/app/admin/DBSID
chown oracle:oinstall /home/oracle/app/admin/DBSID
chmod 775 /home/oracle/app/admin/DBSID

mkdir /home/oracle/app/admin/DBSID/udump
chown oracle:oinstall /home/oracle/app/admin/DBSID/udump
chmod 775 /home/oracle/app/admin/DBSID/udump

mkdir /home/oracle/app/admin/DBSID/bdump
chown oracle:oinstall /home/oracle/app/admin/DBSID/bdump
chmod 775 /home/oracle/app/admin/DBSID/bdump

mkdir /home/oracle/app/admin/DBSID/adump
chown oracle:oinstall /home/oracle/app/admin/DBSID/adump
chmod 775 /home/oracle/app/admin/DBSID/adump

mkdir /home/oracle/app/admin/DBSID/cdump
chown oracle:oinstall /home/oracle/app/admin/DBSID/cdump
chmod 775 /home/oracle/app/admin/DBSID/cdump

mkdir /home/oracle/oradata/flash_recovery_area/DBSID
chown oracle:oinstall /home/oracle/app/admin/DBSID
chmod 775 /home/oracle/oradata/flash_recovery_area/DBSID

mkdir /home/oracle/oradata/data1/DBSID
chown oracle:oinstall /home/oracle/oradata/data1/DBSID
chmod 775 /home/oracle/oradata/data1/DBSID

mkdir /home/oracle/oradata/index/DBSID
chown oracle:oinstall /home/oracle/oradata/index/DBSID
chmod 775 /home/oracle/oradata/index/DBSID

mkdir /home/oracle/oradata/redo/DBSID
chown oracle:oinstall /home/oracle/oradata/redo/DBSID
chmod 775 /home/oracle/oradata/redo/DBSID

Then copy the RMAN control files from the RMAN backup to a new directory. In this exercise that is from
/home/oracle/backup/prod/DBSID/ctlfile to the directory
/home/oracle/backup/prod/DBSID/ctlfile/
cp /home/oracle/backup/prod/DBSID/ctlfile/* .

You will also need a dummy init.ora file as mentioned above for starting the new instance up in nomount
mode. First set the ORACLE_SID

export ORACLE_SID=DBSID

rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Mar 21 20:49:26 2006
connected to target database (not started)

RMAN> startup nomount pfile="/home/oracle/app/OracleHomes/db10g2/dbs/initDBSID.ora";

RMAN> set dbid=3812578829;


executing command: SET DBID

Now we restore the control files and the spfile from the backup.

RMAN>run {
set controlfile autobackup format for device type disk to '/home/oracle/backup/prod/DBSID/ctlfile/%F';
restore spfile from autobackup;
restore controlfile from autobackup;
startup force mount
}

Having restored the spfile and the control files and mounted the instance we now confirm that the control
file contains the metadata for the database and archivelog backups needed to restore and recover the
DBSID database.

RMAN> list backup of database completed after '26-APR-2009';

Once you have found the database backup you need, note the checkpoint scn of the backup, usually the last
one in the list.

To check that the archivelogs needed for recovery have been backed up:
RMAN> list backup of archivelog from scn= 1300544273;

Take not of the scn (sequence) number and insert it in the script below, in this example it is 769.
If all the required metadata needed for restore and recovery is present then you can proceed with restore
and recovery of the database until say, archive log sequence 769:
run { 
      set until sequence = 1800 thread 1; 
      restore database;
      recover database;
      alter database open resetlogs;
      }

And you are done. This process takes around 30 minutes from start to end. Was tested successfully January
23, 2009 where DBSID was re-created on another server and queried against.

Das könnte Ihnen auch gefallen