We had previously created a 2 node RAC physical standby database. Today, we were attempting to bring it up as a primary by issuing the commands:
startup mount; ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
In the alert log we saw the error:
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file ORA-01110: data file 2: '+DG_OLD_SERVER/dbname/ts_name_data_file_01.dbf' ORA-17503: ksfdopn:2 Failed to open file +DG_OLD_SERVER/dbname/ts_name_data_file_01.dbf ORA-15001: diskgroup "+DG_OLD_SERVER" does not exist or is not mounted
The database was attempting to lock a file with the name of the old primary’s ASM file systems. I checked in v$datafile:
select a.name from v$datafile a order by a.file# ;
and all the file names were prefixed by the name of the old primary’s ASM file systems. A check in ASM on the new server revealed that the files existed in ASM prefixed with the new server’s ASM file system names. I suspect that while building the standby the below command was not issued after the recover database:
switch datafile all;
We brought up the database in mount mode and issued commands to rename the files from the old ASM file system to the new ASM file system:
ALTER DATABASE RENAME FILE '+DG_OLD_SERVER/dbname/ts_name_data_file_01.dbf' TO '+DG_NEW_SERVER/dbname/ts_name_data_file_01.dbf';
After all the files were renamed, I checked in v$datafile to confirm the new names. After this we were able to activate the physical standby database as a primary.
Update – February 05, 2018
I built another standby and checked the names of the data files after the recover database and the file names were correctly changed as per the DB_FILE_NAME_CONVERT parameter and hence I cannot explain what went wrong in the original build. However, there is no need to issue the “switch datafile all” command.
Great notes, Dean. Thanks for sharing this.
Quick question though. Doesn’t it RMAN perform the ‘switch datafile all; ‘ after restoring the backup sets?