Friday 16 September 2011

ORA-01113: file 1 needs media recovery - system01.dbf

To clone a RAC DB to a new RAC DB

Login to the old RAC DB and shutdown the database and all nodes. Open the database in nomount state and take a controlfile backup to trace. Change the database to a single instance database by changing the cluster_database parameter to false and take a backup of the control file to trace.

Copy the datafiles and control file from trace into the new location and change the name and location of the new database.

When you open the database, you can experience the below error.

problem:

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/opt/oracle/test/system01.dbf'

If you specify recover database the below error will be shown as the controlfile is a backup controlfile.
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

So specify the using backup controlfile clause.

SQL> recover database using backup controlfile;
ORA-00279: change 39930507 generated at 09/14/2011 13:52:54 needed for thread 2
ORA-00289: suggestion :
/opt/oracle/flash_recovery_area/TEST/archivelog/2011_09_14/o1_mf_2_127_%u_
.arc
ORA-00280: change 39930507 for thread 2 is in sequence #287


Now comes the another issue though you say cancel it will not cancel the media recovery to re-open the database.

The solution to recover the database is by using clause "until Cancel"

SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL

When asked for logs, as below

Specify log: {=suggested | filename | AUTO | CANCEL}

enter "cancel"

Media recovery cancelled.
SQL> alter database open resetlogs;

Database altered.


If you face the similar error then the above action could be one of your solution.

1 comment:

Anonymous said...

Excelente!...

Me sirvió mucho tu solución.

Gracias!