Skip to content

How to Resolve RMAN-06094: datafile 1 must be restored


Tried to recover a database, but it failed with RMAN-06094.

RMAN> recover database;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at
RMAN-06094: datafile 1 must be restored

RMAN-06094 means that RMAN tried to recover data files, but there's no file in the path which is defined in the control file.


If you haven't restore the database, you should restore datafiles to the location you design in order to recover them at that place. It's the sequence to duplicate a database.

If you have restored the database, you might restore it to a location which is not recognized by the control file.

Let's see where the control file expect it.

SQL> select name from v$datafile where file# = 1;


Is it the location you restored? Most likely, this is not the location you restored. I think you forgot to issue SWITCH DATAFILE ALL after RESTORE DATABASE in the run block.

Preventive Actions

There're 2 preventive actions that you may take in the future.


SWITCH DATAFILE ALL explicitly makes all SET NEWNAME FOR DATAFILE statements take effect even after leaving the run block.


Without specifying SWITCH DATAFILE ALL is still OK as long as you add RECOVER DATABASE right after RESTORE DATABASE in the run block. It'll implicitly switch all datafiles to the copy ones, then recover them.

Fixing RMAN-06094

At this moment, we can use SWITCH DATABASE TO COPY or ALTER DATABASE RENAME FILE statement to correct the path in the control file.

Let's see their cases.


To solve RMAN-06094, you don't need to add SWITCH DATAFILE ALL to the run block and run it again. You can just issue one SWITCH DATABASE TO COPY statement to correct them into the new path.

RMAN> switch database to copy;

Data files at new location would be "current" now.


If some data files still have switch problem, you may use ALTER DATABASE RENAME FILE statements individually to make it, too.

SQL> alter database rename file '/u01/app/oracle/oradata/ORCLCDB/system01.dbf' to '/oradata/ORCLCDB/system01.dbf';

Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ORCLCDB/sysaux01.dbf' to '/oradata/ORCLCDB/sysaux01.dbf';

Database altered.

Basically, SWITCH DATAFILE ALL is doing the same things as ALTER DATABASE RENAME FILE statements.

Leave a Reply

Your email address will not be published. Required fields are marked *