Oracle12C ORA-01516报错可能是没有切换到PDB

在Oracle 12C中,当尝试在主备库间同步数据文件时,由于路径不一致导致ORA-01516错误。不同于11G之前的解决方案,12C要求在对应PDB容器中执行数据文件操作。错误源于尝试操作的数据文件不在控制文件中记录,因此需要首先确定正确的PDB并切换到该容器执行操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一次问题:Oracle 12C DB因为主备库server数据文件所在路径不一致,在主库新增datafile后报错:

Thu Mar 22 10:36:06 2019
Errors in file /u01/app/oracle/diag/rdbms/mesdbs/MESDB/trace/MESDB_ora_93029.trc:
ORA-10879: error signaled in parallel recovery slave
ORA-00283: recovery session canceled due to errors
ORA-01111: name for data file 87 is unknown - rename to correct file
ORA-01110: data file 87: '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/UNNAMED00087'
ORA-01157: cannot identify/lock data file 87 - see DBWR trace file
ORA-01111: name for data file 87 is unknown - rename to correct file
ORA-01110: data file 87: '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/UNNAMED00087'


通常这类Case(Oracle11G及之前版本),直接在standby中执行以下步骤即可:

SQL> alter system set standby_file_management='MANUAL';

SQL> alter database create datafile '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/UNNAMED00087' as '/data/MES DB /qmsdb/qms_data06.dbf;

SQL> alter system set standby_file_management='AUTO';

SQL> alter database recover managed standby database using current logfile disconnect;


但在12C中执行却报错了:

ORA-01516 : nonexistent log file, datafile, or tempfile "/u01/app/oracle/product/12.1.0/dbhome_1/dbs/UNNAMED00087"

注: 这里 dbs 目录中 其实 是不存在文件,但并不影响 alter database create datafile XXX as XXX 这个执行仅仅只是修改数据字典( control file)


这是为什么呢?

在文档中看到While adding datafiles in Standby CDB ORA-01516 (文档 ID 2215333.1)


Login to Standby :
==============
sql>alter system set standby_file_management='MANUAL';


Connect to PDB

SQL> alter session set container=idsp;  ---原来需要先进入datafile对应的容器数据库中执行,才可以

Session altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 IDSP MOUNTED
SQL>

SQL> alter database create datafile '/lc2m00/app/oracle/12cR102/dbs/UNNAMED00081' as '+DATA_IDS_DG' size 350M;

Database altered.

SQL> exit

Login to CDB in standby

SQL> alter system set standby_file_management = AUTO;

System altered.

SQL>

SQL> recover standby database;


另外12C中move,online等操作类似

在另一篇官方文档中有看到类似datafile的online操作,也 需要根据v$datafile.CON_ID 结合V$pdbs.CON_ID查出对应的PDB容器数据,再登录PDB执行操作

Although the recovery from the CDB recognizes the datafile (in example, datafile #10), when bringing the datafile online, the CDB does not recognize it.  

As per the architecture of 12c CDB database, online and offline commands must be execute from the same container in which datafile resides as v$datafile and dba_data_files only have the entries of the datafiles belonging to that container.

In this case, the datafile belongs to a PDB and thus the datafile must be onlined after connecting to the PDB.  








来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25583515/viewspace-2639350/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25583515/viewspace-2639350/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值