使用 exp 導出時出現警告:
EXP-00091: Exporting questionable statistics.
原因:客戶端環境變數 NLS_LANG 與資料庫字符集 NLS_CHARACTERSET 不一致,導致統計資訊字符集轉換異常。
$ echo $NLS_LANG AMERICAN SQL> SELECT parameter, value FROM nls_database_parameters WHERE parameter LIKE '%CHARACTERSET%'; PARAMETER VALUE --------------------------- ------------------------------ NLS_CHARACTERSET ZHS16GBK NLS_NCHAR_CHARACTERSET AL16UTF16
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK # 或寫入 ~/.bash_profile 永久生效 exp "'/ as sysdba'" tables=testxuchao.TAB_XN_PY_DICT file=/tmp/x.dmp log=/tmp/x.log # 輸出: Export terminated successfully without warnings.
exp "'/ as sysdba'" tables=testxuchao.TAB_XN_PY_DICT file=/tmp/x.dmp log=/tmp/x.log statistics=none # 輸出: Export terminated successfully without warnings.
statistics=none 會跳過導出表/索引/欄位的統計資訊,導入後需手動 DBMS_STATS.GATHER_TABLE_STATS 重新收集。NLS_LANG=.AL32UTF8 (Oracle 通用 UTF-8 別名) 或目標資料庫字符集。expdp/impdp) 內建字符集轉換,較少遇到此問題,新專案建議改用 Data Pump。