If set standby_file_management = AUTO in standby database, no additional step is required when add tablespaces and datafiles on primary database.
If set standby_file_management = MANUAL (Default) in standby database, need to do the following step:
SQL> select name from v$datafile where ts# in (select ts# from v$tablespace where name='
NAME
--------------------------------------------------------------------------------
Copy data files generated by primary database to standby database.
SQL> alter tablespace
Copy datafiles
SQL> alter tablespace
SQL> alter database rename file '
2
Standby Alert log,
Recovery was unable to create the file as a new OMF file.
MRP0 (PID:6306): MRP0: Background Media Recovery terminated with error 1274
2021-09-30T09:52:36.615649+00:00
Errors in file /refresh/home/app/oracle/diag/rdbms/
ORA-01274: cannot add data file that was originally created as '/refresh/home/app/oracle/oradata/
MRP0 (PID:6306): Managed Standby Recovery not using Real Time Apply
Recovery interrupted!
...............
2021-09-30T09:52:37.237943+00:00
Errors in file /refresh/home/app/oracle/diag/rdbms/
ORA-01110: data file 8: '/refresh/home/app/oracle/product/19.3.0/dbs/UNNAMED00008'
ORA-01565: error in identifying file '/refresh/home/app/oracle/product/19.3.0/dbs/UNNAMED00008'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 7
Checker run found 1 new persistent data failures
Upon adding new datafile on primary standby recovery failing with ORA-01110,ORA-01565 ,ORA-27037 and the datafile created with the name UNNAMMED in $ORACLE_HOME/dbs directory.
1. Datafile location,
Primary,
SQL> col name for a60
SQL> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 /refresh/home/app/oracle/oradata/
2 /refresh/home/app/oracle/oradata/
3 /refresh/home/app/oracle/oradata/
4 /refresh/home/app/oracle/oradata/
5 /refresh/home/app/oracle/oradata/
7 /refresh/home/app/oracle/oradata/
8 /refresh/home/app/oracle/oradata/
On standby,
SQL> select file#,name from v$datafile;
FILE# NAME
---------- ------------------------------------------------------------
1 /refresh/home/app/oracle/oradata/
2 /refresh/home/app/oracle/oradata/
3 /refresh/home/app/oracle/oradata/
4 /refresh/home/app/oracle/oradata/
5 /refresh/home/app/oracle/oradata/
7 /refresh/home/app/oracle/oradata/
8 /refresh/home/app/oracle/product/19.3.0/dbs/UNNAMED00008 <<<<<<<
2. The problem here is DB_CREATE_FILE_DEST (OMF - Oracle Managed File) set to a wrong directory on standby. Irrespective of DB_FILE_NAME_CONVERT(standby) which is set correctly , if OMF is set then the priority give to OMF location and the datafile creation happen in default location $ORACLE_HOME/dbs with name UNNAMMED.
Standby,
SQL> sho parameter db_create_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string +DATA <<< wrong directory
SQL> sho parameter convert
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string /refresh/home/app/oracle/orada
ta/
/oracle/oradata/
log_file_name_convert string /refresh/home/app/oracle/orada
ta/
/oracle/oradata/
pdb_file_name_convert string
1. Remove the DB_CREATE_FILE dest or change to available location.
NOTE : This will prevent only the future event.
SQL> show parameter db_create
To remove OMF(Oracle Managed Files)
SQL>alter system set db_create_file_dest=''
To change the OMF location,
SQL>alter system set db_create_file_dest='
NOTE : This will prevent only the future event.
2. To Resolve the current issue , move the datafile and start the recovery.
2.a Copy the datafile to the new location.
2.b Rename the datafile,
SQL> alter database create datafile '
If the standby is in ASM + OMF then use the below command,
SQL> alter database create datafile '
or
SQL>alter database create datafile '
3. Check the datafile location and start the recovery,
SQL> select file#,name from v$datafile;
SQL>alter database recover managed standby database disconnect;