今天在做測試的時候想查詢資料檔案對應的資料表空間資訊,desc dba_Data_files視圖時發現報不存在這個對象。當時以為自己的DB在mount下沒法查詢是正常的,後來在DB OPEN下查詢 dba_data_files還是報不存在這個對象。頓時感覺疑惑了,其他對象都查詢正常,唯獨DBA_*的視圖都不能正常查詢使用。查詢MOS(文檔 ID 296235.1) 發現如下描述:
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_*視圖。
Oracle視圖基礎詳解與執行個體
物化視圖定義不當引發Oracle效能問題
Oracle 字典和動態視圖
Oracle物化視圖測試
Oracle【定期重新整理】的【基於串連】的物化視圖