Backup Recovery

Restoring the Server Parameter File

SET DBID 
STARTUP FORCE NOMOUNT;

RUN 
{
  SET UNTIL TIME 'SYSDATE-7';
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO '/disk1/control_files/autobackup_%F';
  SET DBID 123456789;
  RESTORE SPFILE TO '/tmp/spfileTEMP.ora' FROM AUTOBACKUP MAXDAYS 10;
}

SPFILE=/tmp/spfileTEMP.ora
STARTUP FORCE PFILE=/tmp/init.ora;
SET DBID 320066378;
RUN 
{
  SET CONTROLFILE AUTOBACKUP FORMAT 
    FOR DEVICE TYPE DISK TO 'autobackup_format';
  RESTORE SPFILE FROM AUTOBACKUP;
}

Performing Recovery with a Backup Control File
If you changed the archiving destination or format during recovery, or if you added new online log members after the backup of the control file,
then RMAN may not be able to automatically catalog a needed online or archived log.
Whenever RMAN cannot find online redo logs and you did not specify an UNTIL time, RMAN reports errors similar to the following

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/29/2007 14:23:09
RMAN-06054: media recovery requesting unknown log: thread 1 scn 86945

In this case, you must use the CATALOG command to manually add the required redo logs to the repository so that recovery can proceed.
export ORACLE_SID=trgta

% rman NOCATALOG
RMAN> CONNECT TARGET /

SET DBID 676549873;
STARTUP NOMOUNT

RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/u01/rman';
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/%F';
  RESTORE SPFILE TO PFILE '?/oradata/test/inittrgta.ora' FROM AUTOBACKUP;
  SHUTDOWN ABORT;
}

STARTUP FORCE NOMOUNT PFILE='?/oradata/test/inittrgta.ora';

RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/u01/rman';
  RESTORE CONTROLFILE FROM AUTOBACKUP;
  ALTER DATABASE MOUNT;
}

CATALOG START WITH '/oracle/oradata/trgt/';

COLUMN NAME FORMAT a60
SPOOL  LOG '/tmp/db_filenames.out'
SELECT FILE# AS "File/Grp#", NAME 
FROM   V$DATAFILE
UNION
SELECT GROUP#,MEMBER 
FROM   V$LOGFILE;
SPOOL OFF
EXIT

RUN
{
  # allocate a channel to the tape device
  ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/u01/rman';

  # rename the datafiles and online redo logs
  SET NEWNAME FOR DATAFILE 1 TO '?/oradata/test/system01.dbf';
  SET NEWNAME FOR DATAFILE 2 TO '?/oradata/test/undotbs01.dbf';
  SET NEWNAME FOR DATAFILE 3 TO '?/oradata/test/cwmlite01.dbf';
  SET NEWNAME FOR DATAFILE 4 TO '?/oradata/test/drsys01.dbf';
  SET NEWNAME FOR DATAFILE 5 TO '?/oradata/test/example01.dbf';
  SET NEWNAME FOR DATAFILE 6 TO '?/oradata/test/indx01.dbf';
  SET NEWNAME FOR DATAFILE 7 TO '?/oradata/test/tools01.dbf';
  SET NEWNAME FOR DATAFILE 8 TO '?/oradata/test/users01.dbf';
  SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo01.log''
      TO ''?/oradata/test/redo01.log'' ";
  SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo02.log''
      TO ''?/oradata/test/redo02.log'' ";

  # Do a SET UNTIL to prevent recovery of the online logs
  SET UNTIL SCN 123456;
  # restore the database and switch the datafile names
  RESTORE DATABASE;
  SWITCH DATAFILE ALL;

  # recover the database
  RECOVER DATABASE;
}

Performing Disaster Recovery

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License