ITPub博客

首页 > 数据库 > Oracle > Oracle12C ORA-01516报错可能是没有切换到PDB

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

原创 Oracle 作者:guocun09 时间:2019-03-26 11:22:46 0 删除 编辑

一次问题: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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
DBA,掌握Oracle,SQLServer,MySQL,hadoop,casscandra等数据库。喜爱深入研究数据库技术原理,擅长管理和优化工作。

注册时间:2011-10-02

  • 博文量
    163
  • 访问量
    587913