impdp导入数据ORA-39142: 版本号 5.1不兼容错误

impdp导入数据ORA-39142: 版本号 5.1不兼容错误

1、错误现象

复制代码
Import: Release 12.1.0.1.0 - Production on 星期三 6月 26 17:07:49 2024

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

连接到: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
ORA-39001: 参数值无效
ORA-39000: 转储文件说明错误
ORA-39142: 版本号 5.1 (在转储文件 "D:\Work\240525\2024052501.dmp" 中) 不兼容

2、错误原因

在服务器上登录:

复制代码
 sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 28 19:38:06 2024

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

是12.2的版本,导入的目标数据库是12.1数据库:

复制代码
1	Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production	0
2	PL/SQL Release 12.1.0.1.0 - Production	0
3	"CORE	12.1.0.1.0	Production"	0
4	TNS for 64-bit Windows: Version 12.1.0.1.0 - Production	0
5	NLSRTL Version 12.1.0.1.0 - Production	0

源端数据库版本12.2,目标端版本12.1,根据Oracle官方impdp兼容性文档:

复制代码
Data Pump file version.
=======================

     Version      Written by     Can be imported into Target:
   Data Pump   database with      10gR1      10gR2      11gR1      11gR2      12cR1      12cR2        18c        19c
Dumpfile Set   compatibility   10.1.0.x   10.2.0.x   11.1.0.x   11.2.0.x   12.1.0.x   12.2.0.x   18.x.y.z   19.x.y.z
------------ --------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
         0.1          10.1.x  supported  supported  supported  supported  supported  supported  supported  supported
         1.1          10.2.x         no  supported  supported  supported  supported  supported  supported  supported
         2.1          11.1.x         no         no  supported  supported  supported  supported  supported  supported
         3.1          11.2.x         no         no         no  supported  supported  supported  supported  supported
         4.1          12.1.x         no         no         no         no  supported  supported  supported  supported
         5.1          12.2.x         no         no         no         no         no  supported  supported  supported
         5.1          18.x.y         no         no         no         no         no         no  supported  supported
         5.1          19.x.y         no         no         no         no         no         no         no  supported

源数据库12.2导出的dmp文件版本是5.1,目标数据库的版本12.1,dmp版本位4.1,因此在导入时出现ORA-39142: 版本号 5.1 不兼容。

解决方法是需要在导出时候加入VERSION=xxx参数,根据MOS文档Export/Import DataPump Parameter VERSION - Compatibility of Data Pump Between Different Oracle Versions (Doc ID 553337.1)中

复制代码
 Export              Use Export Data Pump parameter VERSION=...
      From                 if dumpfile needs to be imported into a
    Source                Target Database with compatibility level
  Database        (value of init.ora/spfile parameter COMPATIBLE):
      With
COMPATIBLE    10.1.0.x.y    10.2.0.x.y    11.1.0.x.y    11.2.0.x.y    12.1.0.x.y    12.2.0.x.y     18.x.y.z     19.x.y.z
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
10.1.0.x.y             -             -             -             -             -             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
10.2.0.x.y  VERSION=10.1             -             -             -             -             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
11.1.0.x.y  VERSION=10.1  VERSION=10.2             -             -             -             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
11.2.0.x.y  VERSION=10.1  VERSION=10.2  VERSION=11.1             -             -             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
12.1.0.x.y  VERSION=10.1  VERSION=10.2  VERSION=11.1  VERSION=11.2             -             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
12.2.0.x.y  VERSION=10.1  VERSION=10.2  VERSION=11.1  VERSION=11.2  VERSION=12.1             -            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
18.x.y.z    VERSION=10.1  VERSION=10.2  VERSION=11.1  VERSION=11.2  VERSION=12.1  VERSION=12.2            -            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------
19.x.y.z    VERSION=10.1  VERSION=10.2  VERSION=11.1  VERSION=11.2  VERSION=12.1  VERSION=12.2 VERSION=18.x            -
---------- ------------- ------------- ------------- ------------- ------------- ------------- ------------ ------------

12.2导出如果需要在12.1导入的话,需要加入参数VERSION=12.1,修改导出语句:

复制代码
peter/************* directory=exdump240625 dumpfile=20240625%U.dmp parallel=12 job_name=expdpjob logfile=20240625.log FILESIZE=32g version=12.1

然而导出的时候,会有多个错误信息:

由于标识符较长, 无法将 TABLE_STATISTICS 导出到版本12.1

复制代码
ORA-39373: cannot export INDEX_STATISTICS to version 12.1 due to long identifiers
ORA-39373: cannot export INDEX_STATISTICS to version 12.1 due to long identifiers
ORA-39373: cannot export INDEX_STATISTICS to version 12.1 due to long identifiers

是索引的统计信息,可以暂时不予理会,数据和表结构能够正常导出,就可以了。

索引,可以重建。

从源数据库中重新增加version参数的dump文件,再次导入到12.1的数据库中,开始导入数据正常,不再报错ORA-39142。

但是到导入统计信息的时候,报了致命错误,如下:

复制代码
处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
处理对象类型 SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
处理对象类型 SCHEMA_EXPORT/STATISTICS/MARKER
ORA-39126: 在 KUPW$WORKER.STATS_LOAD [MARKER] 中 Worker 发生意外致命错误
ORA-30091: 未加载次级转换表

ORA-06512: 在 "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: 在 "SYS.KUPW$WORKER", line 11014

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
00007FFAB557B698     26217  package body SYS.KUPW$WORKER
00007FFAB557B698     11041  package body SYS.KUPW$WORKER
00007FFAB557B698     23568  package body SYS.KUPW$WORKER
00007FFAB557B698     19956  package body SYS.KUPW$WORKER
00007FFAB557B698      4486  package body SYS.KUPW$WORKER
00007FFAB557B698     11765  package body SYS.KUPW$WORKER
00007FFAB557B698      2059  package body SYS.KUPW$WORKER
00007FFAB5583478         2  anonymous block

估计原因是在导出的时候,统计信息就没有能够正常的导出,在导入的时候,就发生了致命错误。

虽然无法解决,但是终于把数据从12.2的数据库中导入到12.1的数据库中。
原来觉得12.1和12.2的小版本差异,不会影响基本的数据库的导入和导出,研究后,发现差异还是比较大的。

相关推荐
ClouGence7 天前
Oracle 数据同步为什么会出现数据不一致?长事务是常被忽略的原因
数据库·后端·oracle
ClouGence13 天前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
曹牧13 天前
Oracle EXPLAIN PLAN
数据库·oracle
贤时间13 天前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心13 天前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle
Curvatureflight14 天前
MySQL 深分页越来越慢?从 LIMIT OFFSET 改成游标分页
数据库·oracle
XZ-07000114 天前
MySQL事务
数据库·mysql·oracle
tiancaijiben14 天前
阿里云函数计算FC如何实现网站的定时任务与自动化
数据库·oracle·dba
xfhuangfu14 天前
Oracle 19c 多租户体系架构介绍
数据库·oracle·架构
杨云龙UP14 天前
Spotlight 接入 Oracle 数据库监控操作指南 2026-06-16
数据库·oracle·性能监控·预警·阈值·spotlight·瓶颈分析