數據泵從高版本導入低版本

數據泵(expdp/impdp)跨版本導入數據庫

本文講述了數據泵(expdp/impdp)怎麼從高版本導入到低版本。以及數據泵(expdp/impdp)在導出時須要注意到問題。oracle

1、原由.net

數據泵(expdp/impdp)在Oracle數據庫10g時,跨版本導入和導出的問題還不太明顯,可是到了Oracle數據庫11g和Oracle數據庫11gR2的版本時,數據泵(expdp/impdp)在跨版本導入和導出時體現的問題,愈來愈明顯。ci

2、問題演示get

我來演示一下,從Oracle數據庫11g用數據泵(expdp)導出數據庫內容,而後用數據泵(impdp)導入到Oracle數據庫10g當中。it

從11.2.0.4版本的Oracle數據庫中,用expdp導出:io

[orcl@prod ~]$ expdp test/test dumpfile=d_tmp:new.exp TABLES=newtable

ExportRelease 11.2.0.4.0 - Production ON Mon JAN 16 15:31:20 2012ast

Copyright (c) 1982, 2011, Oracle AND/OR its affiliates. ALL rights reserved.class

Connected TO: Oracle DATABASE 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options

Starting "TEST"."SYS_EXPORT_TABLE_01": test/******** dumpfile=d_tmp:new.exp tables=new

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported "TEST"."NEW" 6.593 KB 63 rows

Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

 

Dump file set for TEST.SYS_EXPORT_TABLE_01 is:

/tmp/new.exp

Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 15:32:01

1234567891011121314151617 [orcl@prod ~]$ expdp test/test dumpfile=d_tmp:new.exp TABLES=new Export: Release 11.2.0.4.0 - Production ON Mon JAN 16 15:31:20 2012 Copyright (c) 1982, 2011, Oracle AND/OR its affiliates. ALL rights reserved. Connected TO: Oracle DATABASE 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options Starting "TEST"."SYS_EXPORT_TABLE_01": test/******** dumpfile=d_tmp:new.exp tables=new Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 64 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "TEST"."NEW" 6.593 KB 63 rows Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded Dump file set for TEST.SYS_EXPORT_TABLE_01 is: /tmp/new.exp Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 15:32:01

而後導入到10.2.0.4

[orcl2@prod2 ~]$ impdp test/test directory=d_tmp dumpfile=new.exp

Import: Release 10.2.0.4.0 - 64bit Production ON Monday,16 JAN, 2012 15:51:40

Copyright (c) 2003, 2007, Oracle. ALL rights reserved.

Connected TO: Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options

ORA-39001: invalid argument VALUE

ORA-39000: bad dump file specification

ORA-39142: incompatible version NUMBER 3.1 IN dump file "/tmp/new.exp"

12345678 [orcl2@prod2 ~]$ impdp test/test directory=d_tmp dumpfile=new.exp Import: Release 10.2.0.4.0 - 64bit Production ON Monday,16 JAN, 2012 15:51:40 Copyright (c) 2003, 2007, Oracle. ALL rights reserved. Connected TO: Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options ORA-39001: invalid argument VALUE ORA-39000: bad dump file specification ORA-39142: incompatible version NUMBER 3.1 IN dump file "/tmp/new.exp"

出現了由於版本太高沒法導入的錯誤。

3、解決辦法

在用expdp導出時,加入特定參數」VERSION=」後面跟上參數的版本。好比我要導入到的Oracle數據庫版本爲10.2.0.1 則這樣寫:VERSION=10.2.0.1 便可。

[orcl@prod ~]$ expdp test/test dumpfile=d_tmp:newtest.exp TABLES=new version=10.2.0.4

Export: Release 11.2.0.3.0 - Production ON Mon JAN 16 16:22:40 2012

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, OLAP, DATA Mining AND REAL Application Testing options

Starting "TEST"."SYS_EXPORT_TABLE_01": test/******** dumpfile=d_tmp:newtest.exp tables=new version=10.2.0.4

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported "TEST"."NEW" 6.406 KB 63 rows

Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

 

Dump file set for TEST.SYS_EXPORT_TABLE_01 is:

/tmp/newtest.exp

Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 16:28:40

1234567891011121314151617 [orcl@prod ~]$ expdp test/test dumpfile=d_tmp:newtest.exp TABLES=new version=10.2.0.4 Export: Release 11.2.0.3.0 - Production ON Mon JAN 16 16:22:40 2012 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, OLAP, DATA Mining AND REAL Application Testing options Starting "TEST"."SYS_EXPORT_TABLE_01": test/******** dumpfile=d_tmp:newtest.exp tables=new version=10.2.0.4 Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 64 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "TEST"."NEW" 6.406 KB 63 rows Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded Dump file set for TEST.SYS_EXPORT_TABLE_01 is: /tmp/newtest.exp Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 16:28:40

正常導入:

[orcl2@prod2 ~]$ impdp test/test directory=d_tmp dumpfile=newtest.exp

Import: Release 10.2.0.4.0 - 64bit Production ON Monday, 16 JAN, 2012 16:35:30

Copyright (c) 2003, 2007, Oracle. ALL rights reserved.

Connected TO: Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options

Master TABLE "TEST"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "TEST"."SYS_IMPORT_FULL_01": test/******** directory=d_tmp dumpfile=newtest.exp

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported "TEST"."NEW" 6.406 KB 63 rows

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Job "TEST"."SYS_IMPORT_FULL_01" successfully completed at 16:45:20

123456789101112 [orcl2@prod2 ~]$ impdp test/test directory=d_tmp dumpfile=newtest.exp Import: Release 10.2.0.4.0 - 64bit Production ON Monday, 16 JAN, 2012 16:35:30 Copyright (c) 2003, 2007, Oracle. ALL rights reserved. ConnectedTO: Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - 64bit ProductionWITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options Master TABLE "TEST"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "TEST"."SYS_IMPORT_FULL_01": test/******** directory=d_tmpdumpfile=newtest.exp Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "TEST"."NEW" 6.406 KB 63 rows Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Job "TEST"."SYS_IMPORT_FULL_01" successfully completed at 16:45:20

相關文章
相關標籤/搜索