0
点赞
收藏
分享

微信扫一扫

软件行业25年技术发展史

Villagers 2023-09-02 阅读 38
数据库

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='<Tablespace name>');

    NAME
    --------------------------------------------------------------------------------
    <ORACLE_HOME>/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 <Tablespace name> offline;

    Copy datafiles

    SQL> alter tablespace <Tablespace name> online;

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

    SQL> alter database rename file '<ORACLE_HOME>/dbs/UNNAMEDxxxxx' to '<File path copied in step 4>';------可能需要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/<SID>/<SID>/trace/<SID>_mrp0_6306.trc:
ORA-01274: cannot add data file that was originally created as '/refresh/home/app/oracle/oradata/<SID>/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/<SID>/<SID>/trace/<SID>_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/<SID>/system01.dbf
2 /refresh/home/app/oracle/oradata/<SID>/rman2_index01.dbf
3 /refresh/home/app/oracle/oradata/<SID>/sysaux01.dbf
4 /refresh/home/app/oracle/oradata/<SID>/undotbs01.dbf
5 /refresh/home/app/oracle/oradata/<SID>/rman2_data01.dbf
7 /refresh/home/app/oracle/oradata/<SID>/users01.dbf
8 /refresh/home/app/oracle/oradata/<SID>/users02.dbf <<< newly added datafile

On standby,

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

FILE# NAME
---------- ------------------------------------------------------------
1 /refresh/home/app/oracle/oradata/<SID>/system01.dbf
2 /refresh/home/app/oracle/oradata/<SID>/rman2_index01.dbf
3 /refresh/home/app/oracle/oradata/<SID>/sysaux01.dbf
4 /refresh/home/app/oracle/oradata/<SID>/undotbs01.dbf
5 /refresh/home/app/oracle/oradata/<SID>/rman2_data01.dbf
7 /refresh/home/app/oracle/oradata/<SID>/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/<SID>/, /refresh/home/app
/oracle/oradata/<SID>/
log_file_name_convert string /refresh/home/app/oracle/orada
ta/<SID>/, /refresh/home/app
/oracle/oradata/<SID>/
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='<location where space and Oracle file permission is done>';

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

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

SQL> alter database create datafile '<source location>\UNNAMED00005' as <'+ASMDISKGROUPNAME'> size <specify the size of datafile>;

or

SQL>alter database create datafile '<source location>\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;

举报

相关推荐

0 条评论