Oracle 11g Exp遇到ORA-04063

beyondme發表於2011-02-17
Oracle 11g是從Oracle 10g上升級來的。
今天執行exp匯出遇到以下錯誤:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
EXP-00008: ORACLE error 4063 encountered
ORA-04063: package body "DMSYS.DBMS_DM_MODEL_EXP" has errors
ORA-06508: PL/SQL: could not find program unit being called: "DMSYS.DBMS_DM_MODEL_EXP"
ORA-06512: at line 1
EXP-00083: The previous problem occurred when calling DMSYS.DBMS_DM_MODEL_EXP.schema_info_exp

用以下步驟重灌Oracle Data Mining元件:
conn /as sysdba
@?/rdbms/admin/dminst.sql sysaux temp  -元件包
@?/rdbms/admin/odmpatch.sql  --補丁
@?/rdbms/admin/utlrp.sql  --編譯
--確認是否安裝成功
select comp_name,version,status from dba_registry where comp_name='Oracle Data Mining';

但exp依然報同樣的錯誤。
接著看:
SQL> select owner,count(*) from dba_objects where status= 'INVALID' group by owner;

no rows selected
SQL> select owner,object_name,status from dba_objects where object_name = 'DBMS_DM_MODEL_EXP';

OWNER                OBJECT_NAME          STATUS
-------------------- -------------------- -------
SYS                  DBMS_DM_MODEL_EXP    VALID
SYS                  DBMS_DM_MODEL_EXP    VALID
--沒有DMSYS的DBMS_DM_MODEL_EXP包

#vi $ORACLE_HOME/rdbms/admin/dminst.sql
@@odmcrt.sql &&1 &&2

execute sys.dbms_registry.loading('ODM','Oracle Data Mining','validate_odm','SYS',NULL,NULL);

@@odmproc.sql

alter session set current_schema = "SYS";

Rem @@catodm.sql

execute sys.dbms_registry.loaded('ODM');

execute sys.validate_odm;


--懷疑指令碼中使用者搞錯了,把SYS改成DMSYS再裝了遍Oracle Data Mining元件

結果DMSYS下安裝沒成功:
SQL> select owner,object_name,status from dba_objects where object_name = 'DBMS_DM_MODEL_EXP';

OWNER                OBJECT_NAME          STATUS
-------------------- -------------------- -------
SYS                  DBMS_DM_MODEL_EXP    VALID
SYS                  DBMS_DM_MODEL_EXP    VALID
DMSYS            DBMS_DM_MODEL_EXP    INVALID

SQL> select comp_name,version,status from dba_registry where comp_name='Oracle Data Mining';

COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ ----------------------
Oracle Data Mining
11.2.0.2.0                     INVALID

--很無解。。。。

google了很多資料發現:
Oracle 10g中使用DMSYS來管理Oracle Data Mining,Oracle 11g中使用SYS管理;

這個可以從$ORACLE_HOME/rdbms/admin/dminst.sql指令碼中可以看出差別:
--oracle 10g
@@odmcrt.sql &&1 &&2

execute sys.dbms_registry.loading('ODM','Oracle Data Mining','validate_odm','DMSYS',NULL,NULL);

@@odmproc.sql

alter session set current_schema = "DMSYS";

@@catodm.sql

execute sys.dbms_registry.loaded('ODM');

execute sys.validate_odm;


--最終解決:
drop user dmsys cascade;
將dminst.sql中的使用者改回sys後重新執行:
conn /as sysdba
@?/rdbms/admin/dminst.sql sysaux temp  -元件包
@?/rdbms/admin/odmpatch.sql  --補丁
@?/rdbms/admin/utlrp.sql  --編譯

--安裝成功

總結:可能是安裝人員升級時忘了執行odmpatch.sql指令碼,另外從開頭的重灌還是報錯來看,很有可能是由於升級到11g後同時存在dmsys存在原因導致的。



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/405242/viewspace-687463/,如需轉載,請註明出處,否則將追究法律責任。

相關文章