Monday, 7 March 2016

Database Recovery #3 - Recover from cold backup using RMAN

--Take cold backup with RMAN
rman target=/
shutdown immediate;
startup mount;
backup database plus archivelog delete input;
alter database open;
exit;


--Prep the delete script to remove *.dbf files
sqlplus /nolog
conn / as sysdba


spool /tmp/remove_data_files.sql
select '!rm '||file_name from dba_data_files;
spool off
shutdown abort;

--DESTROY datafiles

@/tmp/remove_data_files.sql
exit;

--Try to startup the database

sqlplus /nolog
conn / as sysdba
startup;
--SQL> startup;

--ORACLE instance started.
--Total System Global Area  389189632 bytes

--Fixed Size                  1336736 bytes
--Variable Size             226495072 bytes
--Database Buffers          146800640 bytes
--Redo Buffers               14557184 bytes
--Database mounted.
--ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
--ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
shutdown abort;

exit;



--Restore and recover the database from the cold backup
rman target=/
startup mount;

restore database;
recover database;
--Be a hero

alter database open;

No comments:

Post a Comment