首先需要知道的是:
1.从低版本导出,高版本导入,需要增加version
2.从高版本导出,低版本导入,可以向下兼容。
下面我们来看看《1.从低版本导出,高版本导入》增加version 后,还是报错?
--下面是9i,加了version=11.2.0.1.0导出
[oracle@C8-DL580-GC-RAC1 dumpfiles]$ expdp unic**/******** directory=orabackupdump dumpfile=expdp_0517_ml_1234.dmp logfile=expdp_0517_ml_1234.log tables=TU_PERMISSION,TU_REL_GROUP_RESOURCE,TU_REL_USER_GROUP,TU_GROUPBASEINFO,TU_USERBASEINFO version='11.2.0.1.0'
Export: Release 11.2.0.3.0 - Production on Tue May 17 15:10:26 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "UNICOMIDMP"."SYS_EXPORT_TABLE_01": unico**/******** directory=orabackupdump dumpfile=expdp_0517_ml_1234.dmp logfile=expdp_0517_ml_1234.log tables=TU_PERMISSION,TU_REL_GROUP_RESOURCE,TU_REL_USER_GROUP,TU_GROUPBASEINFO,TU_USERBASEINFO version=11.2.0.3.0
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 20 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "UNICOMIDMP"."TU_GROUPBASEINFO" 7.210 KB 9 rows
. . exported "UNICOMIDMP"."TU_PERMISSION" 23.53 KB 465 rows
. . exported "UNICOMIDMP"."TU_REL_GROUP_RESOURCE" 67.49 KB 1533 rows
. . exported "UNICOMIDMP"."TU_REL_USER_GROUP" 57.61 KB 686 rows
. . exported "UNICOMIDMP"."TU_USERBASEINFO" 107.9 KB 565 rows
Master table "UNICOMIDMP"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for UNICOMIDMP.SYS_EXPORT_TABLE_01 is:
/ora/dumpfiles/expdp_0517_ml_1234.dmp
Job "UNICOMIDMP"."SYS_EXPORT_TABLE_01" successfully completed at 15:10:43
在11g导入,加了version='11.2.0.1.0' 见下面
[oracle@localhost dpdump]$ ls -l
total 544
-rw-r----- 1 oracle oinstall 116 May 10 10:31 dp.log
-rw-r----- 1 oracle oinstall 552960 May 17 14:43 expdp_0517_ml_1234.dmp
[oracle@localhost dpdump]$ impdp un***/***** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version='11.2.0.3';
Import: Release 12.1.0.2.0 - Production on Tue May 17 14:49:22 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
ORA-39006: internal error
ORA-39213: Metadata processing is not available
--我们看看错位描述
[oracle@localhost ~]$ oerr ora 39213
39213, 00000, "Metadata processing is not available"
// *Cause: The Data Pump could not use the Metadata API. Typically,
// this is caused by the XSL stylesheets not being set up properly.
// *Action: Connect AS SYSDBA and execute dbms_metadata_util.load_stylesheets
// to reload the stylesheets.
[oracle@localhost ~]$
--那我们就按照这个方法处理,试试
SQL> execute sys.dbms_metadata_util.load_stylesheets;
PL/SQL procedure successfully completed.
重新执行导入指令:
[oracle@localhost dpdump]$ impdp uni/**** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version='11.2.0.3.0';
Import: Release 12.1.0.2.0 - Production on Tue May 17 15:21:01 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Master table "UNICOMIDMP"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export done in ZHS16GBK character set and UTF8 NCHAR character set
WARNING: possible data loss in character set conversions
Starting "UNICOMIDMP"."SYS_IMPORT_FULL_01": unicomidmp/******** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version=11.2.0.3.0
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "UNICOMIDMP"."TU_GROUPBASEINFO" 7.210 KB 9 rows
. . imported "UNICOMIDMP"."TU_PERMISSION" 23.53 KB 465 rows
. . imported "UNICOMIDMP"."TU_REL_GROUP_RESOURCE" 67.49 KB 1533 rows
. . imported "UNICOMIDMP"."TU_REL_USER_GROUP" 57.61 KB 686 rows
. . imported "UNICOMIDMP"."TU_USERBASEINFO" 107.9 KB 565 rows
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "UNICOMIDMP"."SYS_IMPORT_FULL_01" successfully completed at Tue May 17 15:21:11 2016 elapsed 0 00:00:10
[oracle@localhost dpdump]$
导入成功。