今天在做测试的时候想查询数据文件对应的表空间信息,desc dba_Data_files视图时发现报不存在这个对象。当时以为自己的DB在mount下没法查询是正常的,后来在DB OPEN下查询 dba_data_files还是报不存在这个对象。顿时感觉疑惑了,其他对象都查询正常,唯独DBA_*的视图都不能正常查询使用。查询MOS(文档 ID 296235.1) 发现如下描述:

cuug本周五晚免费Oracle网络公开课《人生最痛苦的事:人还在钱没了——守护数据库的备份信息》

APPLIES TO:

 Oracle Database - Enterprise Edition - Version 8.1.7.4 to 11.2.0.1 [Release 8.1.7 to 11.2]

 Information in this document applies to any platform.

 SYMPTOMS

 If you describe any DBA_* Views (Data dictionary views) in a mount stage, than you will not be able to

  describe those views even after opening the database.

 You can test as follows:

 + Shutdown the database.

 SQL> Shutdown immediate

 + Mount the database.

 SQL> Startup Mount

 + Describe any Data Dictionary view.

 SQL> DESC DBA_DATA_FILES

 ERROR:

 ORA-04043: object DBA_DATA_FILES does not exist.

 + Open the Database.

 SQL> ALTER DATABASE OPEN;

 Database altered

 + Describe the same Data Dictionary view.

 SQL> DESC DBA_DATA_FILES

 ERROR:

 ORA-04043: object DBA_DATA_FILES does not exist

 *** Error will appear till we bounce the Database / flush the shared pool.

 CAUSE

 This is related to Bug 2365821

 Abstract: ORA-4043 ON DBA_* TABLES IF THEY ARE DESCRIBED IN A MOUNT STAGE.

 SOLUTION

 Available workarounds are:

 1) Don't describe the dba_* views at mount stage.

 OR

 2) If you issue DESC of any DBA_*views at mount stage, then shutdown and restart the DB instance.

 OR

 3) Flush the shared pool.

 SQL> Alter system flush shared_pool;

 and then reissue the failing command.


正是由于我在数据库mount状态下查询dba_data_files视图,导致遭遇oracle 数据库产品的Bug 2365821,数据库即使OPEN下也不能正常使用dba_*视图。