oracle数据泵导入遭遇bug记录

下午收到了一个导数据的需求,一张表,20多万数据,小case,却遇到了问题。
关键报错:
ORA-39097 ORA-39065 ORA-01427 ORA-39126 ORA-06502 LPX-00225 导入语句:
impdp "'/as sysdba'" directory=DATA_PUMP_DIR dumpfile=NCHATTAG1.dmp logfile=20180821.log  
log如下:

Import: Release 11.2.0.4.0 - Production on Tue Aug 21 15:59:30 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Master table "SYS"."SYS_IMPORT_FULL_02" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_FULL_02":  "/******** AS SYSDBA" directory=DATA_PUMP_DIR dumpfile=NCHATTAG1.dmp logfile=20180821.log
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "NCHATTAG1"."MESSAGE"                       68.48 MB  205729 rows
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role 'P_WANGYP_R' does not exist
Failing sql is:
GRANT SELECT ON "NCHATTAG1"."MESSAGE" TO "P_WANGYP_R"
ORA-39083: Object type OBJECT_GRANT failed to create with error:
ORA-01917: user or role 'R_NCHATTAG1_READER' does not exist
Failing sql is:
GRANT SELECT ON "NCHATTAG1"."MESSAGE" TO "R_NCHATTAG1_READER"
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.PUT_DDLS [TABLE_STATISTICS]
ORA-06502: PL/SQL: numeric or value error
LPX-00225: end-element tag "HIST_GRAM_LIST_ITEM" does not match start-element tag "EPVALUE"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPW$WORKER", line 9715

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
0x62926f00     21979  package body SYS.KUPW$WORKER
0x62926f00      9742  package body SYS.KUPW$WORKER
0x62926f00     17950  package body SYS.KUPW$WORKER
0x62926f00      4058  package body SYS.KUPW$WORKER
0x62926f00     10450  package body SYS.KUPW$WORKER
0x62926f00      1824  package body SYS.KUPW$WORKER
0x67897468         2  anonymous block

ORA-39097: Data Pump job encountered unexpected error -1427
ORA-39065: unexpected master process exception in DISPATCH
ORA-01427: single-row subquery returns more than one row

Job "SYS"."SYS_IMPORT_FULL_02" stopped due to fatal error at Tue Aug 21 16:00:01 2018 elapsed 0 00:00:30

可以看到dw进程在处理表的统计信息时,在处理直方图信息的时候出现了错误,在源端查询表上确实有直方图。这种内部处理过程出现无法正确处理的情况,可以认为是oracle的bug。解决办法也简单,绕过统计信息即可:
impdp "'/as sysdba'" directory=DATA_PUMP_DIR dumpfile=NCHATTAG1.dmp logfile=20180821.log table_exists_action=replace EXCLUDE=STATISTICS
无报错成功导入。

手动收集统计信息:
oracle@bd-dev-oracle-104:/opt/app/oracle/diag/rdbms/bdcfg/BDCFG/trace$ora ant NCHATTAG1 message
\n=============Tue Aug 21 16:54:43 CST 2018===================
exec DBMS_STATS.GATHER_TABLE_STATS(ownname=>'NCHATTAG1',tabname=>'message',estimate_percent=>10,no_invalidate=>false,cascade=>true,degree => 10);
Can you confirm?[y/n]
y 事后去mos上搜索了一下,可以参考文档 ID 878626.1

公司主营业务:成都网站建设、做网站、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联公司是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联公司推出维西免费做网站回馈大家。


本文标题:oracle数据泵导入遭遇bug记录
分享链接:http://pwwzsj.com/article/gpojhc.html