之前按使用者imp了一個9i的資料庫,今天發現Job 執行失敗,alert log 顯示:
ORA-00904: "DROP_SEGMENTS": invalid identifier
上網搜了一下, 摘抄如下, 說是要執行下catpatch.sql 腳本。
Oracle 9.2.0.5 added the DROP_SEGMENTS column to the DBA_TAB_MODIFICATIONS view. Internally, the dollar table sys.mon_mods$ received the new drop_segments column. Guess who's responsible for adding this new column during the patch process?
Yup, it's catpatch.sql. Oh, joy!
If you don't run catpatch when patching to 9.2.0.5, a few things will happen with regards to the drop_segments column:
SMON will complain profusely in alert.log whenever it tries to update sys.mon_mods$. That means you get this error message every 15 minutes, or sooner:
Thu Nov 25 17:21:05 2004
Errors in file /u01/app/oracle/admin/mydb/bdump/mydb_smon_8201.trc:
ORA-00904: "DROP_SEGMENTS": invalid identifier
DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO will fail.
According to Metalink Note 285315.1, you'll also get the ORA-00904 error in the alert.log on DROP TABLE and TRUNCATE TABLE.
You will get the ORA-00904 error when you try to update statistics with "GATHER STALE".
If you can't update statistics, you will have bad optimizer plans.
解決方法如下:
1. shutdown database
2. startup migrate
3. @?/rdbms/admin/catpatch.sql --更新資料字典
4. @?/rdbms/admin/catalog.sql --建立系統常用的資料字典視圖和同義詞
5. @?/rdbms/admin/utlrp.sql --編譯存儲過程
6. 重新開機資料庫
SQL> describe sys.mon_mods$;
Name Null? Type
----------------- -------- ------------
OBJ# NUMBER
INSERTS NUMBER
UPDATES NUMBER
DELETES NUMBER
TIMESTAMP DATE
FLAGS NUMBER