When you rename a in the primary database, the change won’t be reflected on standby database, even if the STANDBY_FILE_MANAGEMENT initialization parameter is set to AUTO.
Follow below steps for renaming datafile in standby environment:
1. Make standby_file_management parameter to MANUAL [ on both PRIMARY and STANDBY ]
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;
2. Make the tablespace offline ( to which the datafile belongs) [ PRIMARY]
alter tablespace DBATEST offline;
3. move/rename the datafile physically [ PRIMARY]
mv /data/oracle/oradata/dbaclass01.dbf /data/oracle/oradata/dbaclass02.dbf
4. Rename the datafile in controlfile[ PRIMARY]
ALTER DATABASE RENAME DATAFILE '/data/oracle/oradata/dbaclass01.dbf' TO '/data/oracle/oradata/dbaclass02.dbf';
5. Make the tablespace online [ PRIMARY]
alter tablespace DBATEST online;
6. Stop redo apply [ STANDBY]
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
7. Shutdown standby database [ STANDBY ]
shutdown immediate;
8 . Start the database in Mount [ STANDBY ]
startup mount
9. move the datafile physically [ STANDBY]
mv /data/oracle/oradata/dbaclass01.dbf /data/oracle/oradata/dbaclass02.dbf
10. Rename the datafile in standby controlfile[ STANDBY]
ALTER TABLESPACE DBATEST RENAME DATAFILE '/data/oracle/oradata/dbaclass01.dbf' TO '/data/oracle/oradata/dbaclass02.dbf';
11. Start the redo apply [ STANDBY]
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
12. MAke the standby_file_management to AUTO:
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO; NOTE - In oracle 12c , we can rename the datafile online(instead of making it offline and moving it)
While renaming datafile in standby ,please use alter database rename file ‘f1′ to’ f2′;