Oracle12C ORA-01516報錯可能是沒有切換到PDB

guocun09發表於2019-03-26

一次問題: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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章