【故障處理】ORA-31600和ORA-04063錯誤sql
有朋友在執行drop操做時,報了以下的錯誤,通過查詢mos文檔和遠程協助最後終於處理了,記錄下。app
ORA-00604: error occurred at recursive SQL level 1ide
ORA-31600: invalid input value COMPATIBLE for parameter VERSION in function GET_DDLthis
ORA-06512: at "SYS.DBMS_METADATA", line 5805日誌
ORA-06512: at "SYS.DBMS_METADATA", line 8344orm
ORA-06512: at line 1ci
ORA-06512: at line 10文檔
ERROR at line 1:get
ORA-00604: error occurred at recursive SQL level 2input
ORA-04063: package body "SYS.DBMS_METADATA" has errors
ORA-06512: at line 10
解決辦法:
SQL> shutdown immediate
SQL> spool /tmp/spool.txt
SQL> startup upgrade
SQL>@?/rdbms/admin/catupgrd.sql
SQL> shutdown immediate
SQL> spool off
--檢查日誌有沒有特殊的報錯
SQL> Startup
SQL>@?/rdbms/admin/utlrp.sql
ORA-31600 While Running DBMS_METADATA.GET_DDL (文檔 ID 1567572.1)
In this Document
Symptoms |
Cause |
Solution |
Oracle Database - Enterprise Edition - Version 11.2.0.3 and later
Information in this document applies to any platform.
***Checked for relevance on 11-Jan-2016***
While trying to get any table or any object DDL using DBMS_METADATA, the following errors occurs
SQL> select dbms_metadata.GET_DDL('TABLE', 'Table_Name', 'SCHEMA') from dual;
ERROR:
ORA-31600: invalid input value COMPATIBLE for parameter VERSION in function GET_DDL
ORA-06512: at "SYS.DBMS_METADATA", line 3110
ORA-06512: at "SYS.DBMS_METADATA", line 3165
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
The Compatible parameter in database parameters file is set to proper value.
Issue caused by inconsistencies with packages.
1- Shutdown the database if it is not down
2- Run the below steps
SQL> spool /tmp/spool.txt
SQL> startup upgrade
SQL>@?/rdbms/admin/catupgrd.sql
SQL> shutdown immediate
SQL> spool off
3- Startup again with no upgrade option
4- Run utlrp.sql to validate invalide objects
SQL>@?/rdbms/admin/utlrp.sql to validate objects
5- Re-test DBMS_METADATA again
SQL> select dbms_metadata.GET_DDL('TABLE', 'Table_Name', 'SCHEMEA') from dual;