Oracle

使用 IMPDP 將數據庫從 12c 遷移到 19c 失敗

  • April 8, 2022

IMPDP我已經使用和將數據庫從 12c 遷移到 19c EXPDP。導入時我看到了一些錯誤。以下是錯誤的摘錄。

導入期間的錯誤

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type SCHEMA_EXPORT/STATISTICS/MARKER

VM247_RCDB_121GA.PK_TXI : sqlerrm = ORA-20000: Unable to set values for index PK
_TXI: does not exist or insufficient privileges

VM247_RCDB_121GA.PK_ARRE : sqlerrm = ORA-20000: Unable to set values for index P
K_ARRE: does not exist or insufficient privileges

VM247_RCDB_121GA.PK_ARA : sqlerrm = ORA-20000: Unable to set values for index PK
_ARA: does not exist or insufficient privileges

VM247_RCDB_121GA.SYS_C0034921 : sqlerrm = ORA-20000: Unable to set values for in
dex SYS_C0034921: does not exist or insufficient privileges

VM247_RCDB_121GA.PK_TXA : sqlerrm = ORA-20000: Unable to set values for index PK
_TXA: does not exist or insufficient privileges

Importing statistics failed for 20 object(s);

Processing object type SCHEMA_EXPORT/MATERIALIZED_VIEW
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" completed with 22 error(s) at Wed Aug 7 08:2
8:32 2019 elapsed 0 00:05:25

實用程序是:expdp從 12c 和impdp從 19c

發布的命令

在我使用以下命令導出的 12c 實例上:

expdp system/admin@orcl schemas=VM247_RCDB_121GA directory=DATA_PUMP_DIR  
dumpfile=VM247_RCDB_121V10.dmp logfile=VM247_RCDB_121V10.log

…並在 19c 實例上導入:

impdp system/admin@orcl19c schemas=VM247_RCDB_121GA directory=DATA_PUMP_DIR 
dumpfile=VM247_RCDB_121V10.DMP logfile=VM247_RCDB_121V10_imp.log

2.在新系統-Oracle 19c中導入不包括統計資訊:

$ impdp user/password@vcas exclude=statistics dumpfile=dump_file_name.dmp logfile=log_file_name.log  schemas=SCHEMA01, SCHEMA02, SCHEMA03, CHEMA04, SCHEMA05

Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully completed at Wed Apr 7 16:42:59 2021 elapsed 0 00:01:01

*** 排除=統計

2. 然後,手動收集每個模式的表統計資訊,Oracle 19c:

$ sqlplus / as sysdba

SQL> EXEC DBMS_STATS.gather_schema_stats(ownname =>'SCHEMA01', estimate_percent => 100);
PL/SQL procedure successfully completed.

SQL> EXEC DBMS_STATS.gather_schema_stats(ownname =>'SCHEMA02', estimate_percent => 100);
PL/SQL procedure successfully completed.

SQL> EXEC DBMS_STATS.gather_schema_stats(ownname =>'SCHEMA03', estimate_percent => 100);
PL/SQL procedure successfully completed.

SQL> EXEC DBMS_STATS.gather_schema_stats(ownname =>'SCHEMA04', estimate_percent => 100);
PL/SQL procedure successfully completed.

SQL> EXEC DBMS_STATS.gather_schema_stats(ownname =>'SCHEMA05', estimate_percent => 100);
PL/SQL procedure successfully completed.

SQL>退出;

3. 完成!

這是一個已知問題(錯誤 26380126)。解決方法是排除統計資訊,並在目標數據庫中重新收集。或使用導出DBMS_STATS

實際上,Oracle 建議您永遠不要使用數據泵導出統計資訊。請改用上述兩種方法之一。

引用自:https://dba.stackexchange.com/questions/245211