Tuesday, December 20, 2011

Database Recovery #4 - RMAN Recover control file without FLASH_RECOVERY_AREA

--Open rman
rman target=/
--Ensure autobackup is set to on

configure controlfile autobackup on;


--Take note of the DBID, delete backups, make a new backup of the datbase and logs. 
backup database tag='MASTER_DB' plus archivelog tag='MASTER_LOGS' delete input;


--Ensure you have a copy of the controlfile
list backup of controlfile;

exit;


--Move autobackup off to the a new location OUT OF THE instance's FLASH_RECOVERY_AREA
--%F is not just a filename format. It means FOLDERS as well. /FRA/{%F} = /FRA/{ORCL/AUTOBACKUP/YYYYMMDD}
mv /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_12_20/o1_mf_s_770381286_7h0ly6sk_.bkp /u01/backup/ORCL/autobackup/2011_12_20


--Connect to instance and remove the control files from the
database

sqlplus /nolog
conn / as sysdba


spool /tmp/delete_controlfile.sql
select '!rm '||name from v$controlfile;
spool off


--Drop controlfiles
@/tmp/delete_controlfile.sql


--Shutdown abort
shutdown abort;
exit;


--Reconnect to RMAN to recover the database
rman target /


--Startup database in NOMOUNT state and set the DBID (DBID is used when no FRA is available)
startup nomount;
set dbid=1296288227


--Restore the controlfile from the relocated autobackup piece from the new FRA location
restore controlfile from autobackup db_recovery_file_dest='/u01/backup';


--Mount, recover and open resetlogs the instance. 
alter database mount;
recover database;
alter database open resetlogs;

--Delete backups from previous incarnation

delete noprompt backup;

--Take a new backup

backup database tag='MASTER_DB' plus archivelog tag='MASTER_LOGS' delete input;

No comments:

Post a Comment