EXP-00091 EXP导出错误问题困惑
今天要求将部分表数据导出
提供的exp导出脚本如下:
USERID=x/x@xBUFFER=102400ROWS=Y LOG=T_DAYLOG_CALLBYSERVICE.logFILE=T_DAYLOG_CALLBYSERVICE.dmptables=T_DAYLOG_CALLBYSERVICEquery="where logdate between to_date('20150810','YYYYMMDD') and to_date('20150828','YYYYMMDD')"
尝试执行报错
$exp parfile=T_DAYLOG_CALLBYSERVICE.PARExport: Release 10.2.0.4.0 - Production on Tue Sep 1 16:05:15 2015Copyright (c) 1982, 2007, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character setAbout to export specified tables via Conventional Path .... . exporting table T_DAYLOG_CALLBYSERVICE 10197 rows exportedEXP-00091: Exporting questionable statistics.EXP-00091: Exporting questionable statistics.Export terminated successfully with warnings.
如其提示以报错EXP-00091,查看错误
[oracle@SH-SRV-UIDB:/u01/script]$oerr exp 00091
00091, 00000, "Exporting questionable statistics."
// *Cause: Export was able export statistics, but the statistics may not be
// usuable. The statistics are questionable because one or more of
// the following happened during export: a row error occurred, client
// character set or NCHARSET does not match with the server, a query
// clause was specified on export, only certain partitions or
// subpartitions were exported, or a fatal error occurred while
// processing a table.
// *Action: To export non-questionable statistics, change the client character
// set or NCHARSET to match the server, export with no query clause,
// export complete tables. If desired, import parameters can be
// supplied so that only non-questionable statistics will be imported,
// and all questionable statistics will be recalculated.
根据上述的要求可能是字符集不符合,或者导出时指定查询子,分区或子分区被导出,或处理表的时候发生的错误等(翻译能力有限,仅能这样理解)。
查看客户端和服务端字符集是否相符
SQL> select userenv('language') from dual;USERENV('LANGUAGE')----------------------------------------------------AMERICAN_AMERICA.ZHS16GBKselect * from nls_database_parameters t where t.parameter='NLS_CHARACTERSET'; select * from v$nls_parameters where parameter='NLS_CHARACTERSET'
在环境变量中增加语言设定
export NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'echo $NLS_LANG
重新导出依旧报00091的错,尝试去掉query也报错,修改脚本尝试使用expdp工具导出表。
USERID=x/x@xDIRECTORY=BACKUPDIRCOMPRESSION=NONECONTENT=ALLLOGFILE=T_DAYLOG_CALLBYSERVICE.logDUMPFILE=T_DAYLOG_CALLBYSERVICE.dmpTABLES=T_DAYLOG_CALLBYSERVICEQUERY="where logdate between to_date('20150810','YYYYMMDD') and to_date('20150828','YYYYMMDD')"
查看日志正确导出,但仔细观察发现导出的行数与exp导出相同均为10197行。
Export: Release 10.2.0.4.0 - 64bit Production on Tuesday, 01 September, 2015 15:24:24Copyright (c) 2003, 2007, Oracle. All rights reserved.;;; Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsStarting "ICD"."SYS_EXPORT_TABLE_01": parfile=T_DAYLOG_CALLBYSERVICE.PAR Estimate in progress using BLOCKS method...Processing object type TABLE_EXPORT/TABLE/TABLE_DATATotal estimation using BLOCKS method: 168 MBProcessing object type TABLE_EXPORT/TABLE/TABLEProcessing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANTProcessing object type TABLE_EXPORT/TABLE/INDEX/INDEXProcessing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICSProcessing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS. . exported "ICD"."T_DAYLOG_CALLBYSERVICE" 980.4 KB 10197 rowsMaster table "ICD"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded******************************************************************************Dump file set for ICD.SYS_EXPORT_TABLE_01 is: /u01/temp/T_DAYLOG_CALLBYSERVICE.dmpJob "ICD"."SYS_EXPORT_TABLE_01" successfully completed at 15:24:28
也就是说,导出应该是成功的,但因为某些原因还是报错。
在文档EXP Utility Reports EXP-91 During Export (文档 ID 730106.1)中,笔者找到了这个问题的解释。
Oracle统计量是CBO的工作基础。Oracle优化器在发展历程中,经历了从RBO到CBO的演变过程。RBO时代,优化器生成规则是以代码的方式固化在Oracle代码中的。而CBO的工作是基于数据对象统计量。统计量反映在实体上,就是一系列的元数据信息。在9i时代,CBO与RBO共同作用,而且统计量是需要人工进行收集维护的。而且,由于数据变化的原因,在一些早期CBO版本中,"实时"统计量往往还不能获得最好的执行计划。所以,在9i的Exp/Imp工具开始,统计量导出就成为Exp工具默认行为。
也就是说exp工具在导出时使用了统计功能,而报错的发生就和统计有关。问题没有能解决