14 August, 2012

Issue a RECOVER for a Tablespace/Datafile that does not need recovery

Today's Question : What happens if you issue an RMAN RECOVER for a Tablespace or Datafile that is current and does not need recovery ?


Notice the smart "recover if needed" that is executed ?


RMAN> recover datafile 5;

Starting recover at 14-AUG-12
using channel ORA_DISK_1

starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/14/2012 22:57:48
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
 datafile 5
ORA-00283: recovery session canceled due to errors
ORA-01124: cannot recover data file 5 - file is in use or recovery
ORA-01110: data file 5: '/home/oracle/app/oracle/oradata/orcl/example01.dbf'

RMAN> sql 'alter tablespace example offline';

sql statement: alter tablespace example offline

RMAN> recover datafile 5;

Starting recover at 14-AUG-12
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 14-AUG-12

RMAN> sql 'alter tablespace example online';

sql statement: alter tablespace example online

RMAN> 
I did a "dummy" recovery with the tablespace offline. .
.
.
.

3 comments:

Noons said...

Nifty! Never seen that "if needed" before. Thanks for the insight.

Unknown said...

good noticed.

Unknown said...

great...