UNNAMEDxxxxx standby_file_management = MANUAL OMF ASM

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:

  1. After adding tablespaces, datafiles on the primary database, perform a log switch to generate archive log.
     
  2. Apply the generated archivelogs to the standby database.
     
  3. Check added datafile name from v$datafile.

    SQL> select name from v$datafile where ts# in (select ts# from v$tablespace where name='');

    NAME
    --------------------------------------------------------------------------------
    /dbs/UNNAMEDxxxxx
    Copy data files generated by primary database to standby database.

  4. After taking the tablespaces with the generated data files offline on the primary database, copy the data file on the primary server to the standby server.
    Copy destination can be any directory.

    SQL> alter tablespace offline;

    Copy datafiles

    SQL> alter tablespace online;

    Can also use begin backup/end backup instead of offline/online.
     
  5. Rename datafiles in standby database.

    SQL> alter database rename file '/dbs/UNNAMEDxxxxx' to '';------可能需要recover datafile

  6. Resume log apply on standby database

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///trace/_mrp0_6306.trc:
ORA-01274: cannot add data file that was originally created as '/refresh/home/app/oracle/oradata//users02.dbf'
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///trace/_mz00_16532.trc:
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

CAUSE

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//system01.dbf
2 /refresh/home/app/oracle/oradata//rman2_index01.dbf
3 /refresh/home/app/oracle/oradata//sysaux01.dbf
4 /refresh/home/app/oracle/oradata//undotbs01.dbf
5 /refresh/home/app/oracle/oradata//rman2_data01.dbf
7 /refresh/home/app/oracle/oradata//users01.dbf
8 /refresh/home/app/oracle/oradata//users02.dbf <<< newly added datafile

On standby,

SQL> select file#,name from v$datafile;

FILE# NAME
---------- ------------------------------------------------------------
1 /refresh/home/app/oracle/oradata//system01.dbf
2 /refresh/home/app/oracle/oradata//rman2_index01.dbf
3 /refresh/home/app/oracle/oradata//sysaux01.dbf
4 /refresh/home/app/oracle/oradata//undotbs01.dbf
5 /refresh/home/app/oracle/oradata//rman2_data01.dbf
7 /refresh/home/app/oracle/oradata//users01.dbf
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//, /refresh/home/app
/oracle/oradata//
log_file_name_convert string /refresh/home/app/oracle/orada
ta//, /refresh/home/app
/oracle/oradata//
pdb_file_name_convert string

SOLUTION

 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 '\UNNAMED00005' as '';

If the standby is in ASM + OMF then use the below command,

SQL> alter database create datafile '\UNNAMED00005' as <'+ASMDISKGROUPNAME'> size ;

or

SQL>alter database create datafile '\UNNAMED00005>' as new;

3. Check the datafile location and start the recovery,

SQL> select file#,name from v$datafile;
SQL>alter database recover managed standby database disconnect;

你可能感兴趣的:(数据库)