最近在使用expdp导出数据库的时候,碰到一个expdp的问题,报错如下:
Export: Release 12.2.0.1.0 - Production on Wed Sep 19 11:08:27 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rightsreserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 -64bit Production
Starting "EXPDP"."SYS_EXPORT_SCHEMA_04":expdp/********@xxx:1521/xxx directory=dbback dumpfile=xxx schemas=xxx logfile=xxx.log
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-39014: One or more workers have prematurely exited.
ORA-39029: worker 1 with process name "DW00" prematurely terminated
ORA-31671: Worker process DW00 had an unhandled exception.
ORA-00600: internal error code, arguments: [qosdExpStatRead: expcntmismatch], [], [], [], [], [], [], [], [], [], [], [] ★★
ORA-06512: at "SYS.DBMS_STATS", line 1976
ORA-06512: at "SYS.DBMS_STATS", line 52343
ORA-06512: at "SYS.DBMS_STATS", line 52567
ORA-06512: at "SYS.KUPW$WORKER", line 28772
ORA-06512: at "SYS.KUPW$WORKER", line 3265
ORA-06512: at "SYS.KUPW$WORKER", line 13063
ORA-06512: at "SYS.KUPW$WORKER", line 2311
ORA-06512: at line 2
Job "EXPDP"."SYS_EXPORT_SCHEMA_04" stopped due tofatal error at Wed Sep 19 11:11:29 2018 elapsed 0 00:03:02
当时碰到这个问题的时候,赶紧上mos上搜了一下,发现没有命中的bug,然后就在oracle的官网上提了SR,官方回复是使用下面的一个看起来很风骚的语句查看结果:
SQL> alter session set container=xxx;
SQL> With b as (
2 select count(*) cnt,objn,snapshot_id from sys.exp_stat$ esgroup by objn,snapshot_id)
3 select * from sys.exp_obj$ a, b where a.objn=b.objn anda.snapshot_id=b.snapshot_id
4 and a.EXP_CNT<>b.CNT;
OBJN SNAPSHOT_ID EXP_CNT CNT OBJN SNAPSHOT_ID ★★
---------- ----------- ---------- ---------- ---------- -----------
196704 1 228 65764 196704 1
196696 1 8 65544 196696 1
196668 1 3 65539 196668 1
果然,通过SQL的执行结果可以看出来sys.exp_obj$和sys.exp_stat$之间有mismatch。
参考以下步骤操作成功后,重新尝试expdp。
------
1. Ensure that you have taken a backup of your system before applying therecommended solution. ==>> 这一步也很重要,因为后面的操作要对数据字典表进行更新。
2. fix issue data.
sqlplus / as sysdba
alter session set container=<container_name>; ==>> 将container_name替换成您的xxx,<objn>替换成之前SQL语句选出的objn
update sys.exp_obj$ a set exp_cnt=(select count(*) from sys.exp_stat$ bwhere
a.objn=b.objn and a.snapshot_id=b.snapshot_id ) where a.objn=<objn>;
commit;
--出来几行跑几次。
3. Once the scripts complete, confirm that the data is corrected. (noissue data return) ==>> 执行成功后用之前的SQL语句检查
You can use the same SQL to confirm:
With b as (
select count(*) cnt,objn,snapshot_id from sys.exp_stat$ es group byobjn,snapshot_id)
select * from sys.exp_obj$ a, b where a.objn=b.objn anda.snapshot_id=b.snapshot_id
and a.EXP_CNT<>b.CNT;
------
执行更新数据字典的语句之后,这个pdb就其他的pdb一样了,正常的应该是没有结果的。
然后重新expdp数据,成功。
后来又了解了一下原因,当前这个现象暂时没有已知的公开文档或者bug来解释。能确认到的就是sys.exp_obj$和sys.exp_stat$之间有数据的mismatch,造成了这个现象。
至于为什么会产生不一致,这个结果目前未知。。。




