Tried to recover a database, but it failed with RMAN-06094.
RMAN> recover database;
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
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.
There're 2 preventive actions that you may take in the future.
SWITCH DATAFILE ALL
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.
At this moment, we use ALTER DATABASE RENAME FILE statement to correct the path in the control file.
ALTER DATABASE RENAME FILE
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;
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';
SQL> alter database rename file '/u01/app/oracle/oradata/ORCLCDB/sysaux01.dbf' to '/oradata/ORCLCDB/sysaux01.dbf';
Basically, SWITCH DATAFILE ALL is doing the same things as ALTER DATABASE RENAME FILE statements.