数据库在使用DataPump导出时碰到了ORA-39125与ORA-04063。完整的ORA-39125提示是Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA while calling DBMS_METADATA.FETCH_XML_CLOB [OBJECT_GRANT:"GX_ADMIN"],在使用包DBMS_METADATA.FETCH_XML_CLOB时碰到错误。
1、产生ORA-39125与ORA-04063
oracle@linux-ejad:~> export ORACLE_SID=SZ4701
oracle@linux-ejad:~> expdp \'\/ as sysdba \' directory=db_dump_dir dumpfile=sz4701.dmp logfile=exp_4701.log schemas=gx_admin
Export: Release 10.2.0.3.0 - 64bit Production on Tuesday, 05 November, 2013 13:49:23
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
Starting "SYS"."SYS_EXPORT_SCHEMA_01": '/******** AS SYSDBA' directory=db_dump_dir dumpfile=sz4701.dmp logfile=exp_4701.log
schemas=gx_admin
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 447.8 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.UNLOAD_METADATA while calling DBMS_METADATA.FETCH_XML_CLOB
[OBJECT_GRANT:"GX_ADMIN"]
ORA-04063: view "SYS.KU$_CLUSTER_VIEW" has errors
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 6234
----- PL/SQL Call Stack -----
object line object
handle number name
0x7605bab0 14916 package body SYS.KUPW$WORKER
0x7605bab0 6293 package body SYS.KUPW$WORKER
0x7605bab0 2339 package body SYS.KUPW$WORKER
0x7605bab0 6854 package body SYS.KUPW$WORKER
0x7605bab0 1259 package body SYS.KUPW$WORKER
0x835e2470 2 anonymous block
Job "SYS"."SYS_EXPORT_SCHEMA_01" stopped due to fatal error at 13:49:37
2、分析错误
oracle@linux-ejad:~> oerr ora 39125
39125, 00000, "Worker unexpected fatal error in %s while calling %s [%s]"
// *Cause: An unhandled exception was detected internally within the worker
// process for the Data Pump job while calling the specified external
// routine. This is an internal error. Additional information may be
// supplied.
// *Action: If problem persists, contact Oracle Customer Support.
--第一个ORA告诉我们是一个内部错误,联系Oracle Support
oracle@linux-ejad:~> oerr ora 04063
04063, 00000, "%s has errors"
// *Cause: Attempt to execute a stored procedure or use a view that has
// errors. For stored procedures, the problem could be syntax errors
// or references to other, non-existent procedures. For views,
// the problem could be a reference in the view's defining query to
// a non-existent table.
// Can also be a table which has references to non-existent or
// inaccessible types.
// *Action: Fix the errors and/or create referenced objects as necessary.
--第二个ORA给出了相对比较具体一些的信息,执行过程或使用试图时有一些错误发生。
--结合导出时的错误提示来看是系统过程和视图调用出现了问题
--Oracle Metalink Doc ID 742018.1 给出了针对这个问题的解决方案。
--通常是由于一个全新的安装而部分组件无效所致。需要重建相关数据字典。
3、解决故障
SQL> set linesize 190
SQL> col comp_id for a12;
SQL> col comp_name for a35;
SQL> col version for a12;
SQL> select comp_id, comp_name, version, status from dba_registry;
COMP_ID COMP_NAME VERSION STATUS
------------ ----------------------------------- ------------ ---------------------------------
OLS Oracle Label Security 10.2.0.3.0 VALID
EXF Oracle Expression Filter 10.2.0.3.0 VALID
OWM Oracle Workspace Manager 10.2.0.1.0 VALID
CATALOG Oracle Database Catalog Views 10.2.0.3.0 INVALID
CATPROC Oracle Database Packages and Types 10.2.0.3.0 INVALID
JAVAVM JServer JAVA Virtual Machine 10.2.0.3.0 VALID
XML Oracle XDK 10.2.0.3.0 VALID
CATJAVA Oracle Database Java Packages 10.2.0.3.0 VALID
--从上面的查询可知,当前有2个组件处于INVALID状态
--下面直接列出meatlink给出关于这个问题的解决步骤
cd $ORACLE_HOME/rdbms/admin
SQL> startup restrict
SQL> select count(*) from dba_objects where status='INVALID';
SQL> @catalog
SQL> @catproc
SQL> @utlrp <== To compile the invalid objects
SQL> select count(*) from dba_objects where status='INVALID';
col comp_id for a12
col comp_name for a30
col version for a12
select comp_id, comp_name, version, status from dba_registry;
SQL> shutdown immediate
SQL> startup
--完成上面的操作后,再次导出成功。
--注,重建数据字典动作较大,建议先备份数据库后再操作
--转自