ORA-04063: package body "SYS.DBMS_EXPORT_EXTENSION" has errors

转帖:
http://www.net527.cn/shujukuguanli/Oracle/2010/0503/10110.html
 
今天同事碰到一个问题:
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.DBMS_EXPORT_EXTENSION" has errors
ORA-06508: PL/SQL: could not find program unit being called
 
网上google了一把,这篇文章很像,转帖,记录

数据库升级,full import通常会导致一些系统的package,function,trigger失效,这可能会导致exp出现问题,很显然,expyoujiaohuan/'>备份失败的大部分和数据库升级迁移有关。正好我前天在做一个full import的数据库迁移,之后新库的expyoujiaohuan/'>备份就出现了错误

$ exp system/abc123 full=y buffer=65536 rows=y  file=/home/oracle/fwsms_$backup_date.dmp
About to export the entire database ...
. exporting tablespace definitions
.  about to export SYSTEM's tables via Conventional Path ...
. . exporting table            AQ$_INTERNET_AGENTS          0 rows exported
. . exporting table       AQ$_INTERNET_AGENT_PRIVS          0 rows exported
EXP-00056: ORACLE error 904 encountered
ORA-00904: "SYS"."DBMS_EXPORT_EXTENSION"."FUNC_INDEX_DEFAULT": invalid identifier
. . exporting table                           AUD$          0 rows exported
. . exporting table                    DEF$_AQCALL          0 rows exported
EXP-00056: ORACLE error 904 encountered

出现了一大堆的报 错信息,exp备份出现问题,我相信大部分人都遇到过烦人的exp报错,
EXP-00056: ORACLE error 904 encountered,简单的提示,我们并没有得到具体的错误信息。想办法跟踪一下看到底什么导致备份失败

1.使用errorstack跟踪错误信息
$ sqlplus "/ as sysdba"

SQL> alter system set events '904 trace name errorstack ' ;

System altered.


2.执行exp脚本,使跟踪能捕捉到详细的错误信息。
$ exp system/abc123 full=y buffer=65536 rows=y  file=/home/oracle/fwsms_$backup_date.dmp

3.关闭对错误信息的跟踪
SQL> alter system set events='904 trace name errorstack off';

  查看跟踪到的报错信息
$ more fwsms_ora_29535.trc
/u01/app/oracle/admin/fwsms/udump/fwsms_ora_29535.trc
Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.DBMS_EXPORT_EXTENSION" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
Current SQL statement for this session:
BEGIN        :EXEC_STR := SYS.DBMS_EXPORT_EXTENSION.PRE_TABLE(:OWNER, :TABNAME);      END;

 

从跟踪文件中可以看出是SYS.DBMS_EXPORT_EXTENSION这个package导致备份失败,定位出具体的错误信息就好办多了,可以 google或是从metalink得到答案

 

4.下面是SYS.DBMS_EXPORT_EXTENSION的解决办法(from metalink)

1)ORA-4068, ORA-4063, ORA-6508, ORA-6512 DURING EXPORT

2)ORA-19206 EXP-00056 While Taking Export

1)Problem Description:
====================

When you try to do an export, you immediately receive the following error
messages:

ORA-4068 existing state of packages dbms_export_extension
has been discarded"

ORA-4063 dbms_export_extension has errors

ORA-6508 pl/sql could not find program unit being called

ORA-06512
*Cause: Backtrace message as the stack is unwound by unhandled
exceptions.
*Action: Fix the problem causing the exception or write an exception
handler for this condition. Or you may need to contact your
application administrator or DBA.

Solution Description:
=====================

Use -SELECT OBJECT_NAME, OBJECT_TYPE FROM DBA_OBJECTS WHERE STATUS =
'INVALID' AND WNER = 'SYS';

From the select statement you should see that DBMS_EXPORT_EXTENSIONS package
body is invalid.

If the select statement returns more than 1 invalid 'DBMS_?' object it may
indicate a recent upgrade. You may need to just run your upgrade scripts,
which are dependant on the version to and from which you upgraded. You may
want to try running catalog.sql and catproc.sql first. If this does not
resolve the issue try issuing the following statement:

ALTER PACKAGE DBMS_EXPORT_EXTENSION COMPILE BODY;

If you receive errors during the statement, type: "SHOW ERRORS"
This may give you additional information as to why the package body is not
compiling. Select from user_errors if the 'show errors' does not give you
additional information.

There are two scripts that create the package and package body, they are
dbmspexp.sql and prvtpexp.plb. You can try running this manually by doing the
following: (please note that you must be connected internal and should be in
sqldba or server manager.)

>@dbmspexp.sql
>@prvtpexp.plb

If this still does not resolve the issue you may have to relink PL/SQL.
Perform. the following steps in the order given:

1.) shutdown database

2.) login as oracle

3.) cd to ?/rdbms/lib

4.) make -f oracle.mk procopt install

5.) startup database

6.) run catproc.sql from ?/rdbms/admin after connecting internal

If all else fails, deinstall and reinstall PL/SQL. In some cases, this was
the only solution that worked.


If alter compile is not compiling package and the error is
"identifier ... must be declared", try copying relevant
files from CD and retry.

For Example: Say you were not able to compile dbms_aq_import_internal
package. You get error:

"Identifier get_current_schema must be declared"

during compilation. Only after copying "prvtaqad.plb" from CD-ROM and rerunning
"catqueue.sql" made the above package valid.

 

2)Symptom:
---------

During export you receive the following errors:

EXP-00056: ORACLE error 19206 encountered
ORA-19206: Invalid value for query or REF CURSOR parameter
ORA-06512: at "SYS.DBMS_XMLGEN", line 83
ORA-06512: at "SYS.DBMS_METADATA", line 345
ORA-06512: at "SYS.DBMS_METADATA", line 410
ORA-06512: at "SYS.DBMS_METADATA", line 449
ORA-06512: at "SYS.DBMS_METADATA", line 1156
ORA-06512: at "SYS.DBMS_METADATA", line 1141
ORA-06512: at line 1
EXP-00056: ORACLE error 19206 encountered
EXP-00000: Export terminated unsuccessfully

Cause:
------

XDB installation/dictionary built causes some of the underlying XML views to be INVALID.
Here the error occurs when dbms_xmlgen tries to access one those invalid views.


Fix:
----

Run the following script. that resides under
$ORACLE_HOME/rdbms/admin directory after XDB dictionary is built
by connecting as user SYS :

catmeta.sql (Creates Object Model of Oracle dictionary)

After running this script, start the export of database again.

 

参考文献:http://www.net527.cn/shujukuguanli/Oracle/2010/0503/10110.html

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9252210/viewspace-695102/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9252210/viewspace-695102/

你可能感兴趣的:(ORA-04063: package body "SYS.DBMS_EXPORT_EXTENSION" has errors)