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的小版本差异,不会影响基本的数据库的导入和导出,研究后,发现差异还是比较大的。

相关推荐
清和与九1 天前
binLog、redoLog和undoLog的区别
数据库·oracle
兮兮能吃能睡1 天前
SQL中常见的英文术语及其含义
数据库·sql·oracle
我笔记1 天前
关系型数据库RDBMS与非关系型数据库NoSQL区别
数据库·oracle
q_p4482 天前
Oracle VirtualBox查不到ip
oracle·虚拟机
Albert Edison2 天前
【MySQL】数据类型
数据库·mysql·adb·oracle
绵绵细雨中的乡音2 天前
MySQL 数据库核心操作全解析:从创建到备份与连接管理
数据库·oracle
木易 士心2 天前
AI 在数据库操作中的各类应用场景、方案与实践指南
数据库·人工智能·oracle
解决问题no解决代码问题2 天前
oracle删除表与表空间清理机制
数据库·oracle
曹牧2 天前
oracle:To_char
数据库·oracle
姚远Oracle ACE2 天前
解读Oracle AWR报告:Global Cache and Enqueue Services - Workload Characteristics
数据库·oracle