EXP-00091 EXP導出錯誤問題困惑

今天要求將部分表數據導出html

提供的exp導出腳本以下:bash

USERID=x/x@x
BUFFER=102400
ROWS=Y 
LOG=T_DAYLOG_CALLBYSERVICE.log
FILE=T_DAYLOG_CALLBYSERVICE.dmp
tables=T_DAYLOG_CALLBYSERVICE
query="where logdate between to_date('20150810','YYYYMMDD') and  to_date('20150828','YYYYMMDD')"

嘗試執行報錯oracle

$exp parfile=T_DAYLOG_CALLBYSERVICE.PAR
Export: Release 10.2.0.4.0 - Production on Tue Sep 1 16:05:15 2015
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table         T_DAYLOG_CALLBYSERVICE      10197 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.

如其提示以報錯EXP-00091,查看錯誤app

[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.ide

根據上述的要求多是字符集不符合,或者導出時指定查詢子,分區或子分區被導出,或處理表的時候發生的錯誤等(翻譯能力有限,僅能這樣理解)。工具

查看客戶端和服務端字符集是否相符優化

SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
select * 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@x
DIRECTORY=BACKUPDIR
COMPRESSION=NONE
CONTENT=ALL
LOGFILE=T_DAYLOG_CALLBYSERVICE.log
DUMPFILE=T_DAYLOG_CALLBYSERVICE.dmp
TABLES=T_DAYLOG_CALLBYSERVICE
QUERY="where logdate between to_date('20150810','YYYYMMDD') and  to_date('20150828','YYYYMMDD')"

查看日誌正確導出,但仔細觀察發現導出的行數與exp導出相同均爲10197行。server

Export: Release 10.2.0.4.0 - 64bit Production on Tuesday, 01 September, 2015 15:24:24
Copyright (c) 2003, 2007, Oracle.  All rights reserved.
;;; 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "ICD"."SYS_EXPORT_TABLE_01":  parfile=T_DAYLOG_CALLBYSERVICE.PAR 
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 168 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS. . exported "ICD"."T_DAYLOG_CALLBYSERVICE"             980.4 KB   10197 rows
Master table "ICD"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ICD.SYS_EXPORT_TABLE_01 is:
  /u01/temp/T_DAYLOG_CALLBYSERVICE.dmp
Job "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工具在導出時使用了統計功能,而報錯的發生就和統計有關。問題沒有能解決

相關文章
相關標籤/搜索