您好,登錄后才能下訂單哦!
今天要求將部分表數據導出
提供的exp導出腳本如下:
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')"
嘗試執行報錯
$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,查看錯誤
[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.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行。
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工具在導出時使用了統計功能,而報錯的發生就和統計有關。問題沒有能解決
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。