Monday, February 2, 2015

RMAN - Recovering a data file loss

If you lose a data file, it will be reported. To recover it try these steps.

rman target / catalog rman/rman@rmandb
list failure;
(this displays details of the problem unless you've just deleted the file yourself when it might not yet have been reported)

advise failure;
(this is really useful because not only does it give you possible strategies for recovery, but it creates the script to)

In the test I did, I removed a datafile manually (users01.dbf). Then I tried to create a table in that tablespace which resulted in an error.
Then turning to RMAN, list failure showed 'one or more datafiles missing'. Advise failure told me to restore and recover datafile 6.

So I did this in rman

sql 'alter database datafile 6 offline';
recover datafile 6;
restore datafile 6;
sql 'alter database datafile 6 online';

But that's exactly what the 'hm' script, produced by advise failure, did. So just run it.


Happyjohn

No comments:

Post a Comment