日期:2014-05-16  浏览次数:20420 次

使用EXP/IMP从oracle 11g向9i迁移数据问题解决

有客户要将一些数据(有些大表几千万)从Oracle 11gR1库导到Oracle 9iR2老库里面,但发现exp无法导出数据,也没有报什么错误,如下:

?

exp xxx/xxx@xxx file=d:\xxx.DMP log=d:\xxx.log tables=xxx statistics=none

?

Export: Release 9.2.0.5.0 - Production on ???

Copyright (c) 1982, 2002, Oracle Corporation. ?All rights reserved.

?

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

With the Partitioning and Real Application Clusters options

Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set

server uses AL32UTF8 character set (possible charset conversion)

?

正常情况下后面还应该是xxx ???rows导出的显示,这里exp就直接退出了,感觉是exp程序内部出了异常,但没有打印出来。

?

以前看过exp/imp的兼容矩阵说明,一般低版本的exp从高版本库里面导出,再用低版本的imp导入到低版本库里面是没有问题的,但实际也没这么操作过,猜测是oracle自己bug吧,这个也不稀奇了。在oracle support上搜索了一番,看到一个oracle的一个小bug,感觉比较靠谱:

?

SOLUTION

1. Connect to database 11g as SYSDBA with SQL*Plus

2. Change the definition of view EXU9DEFPSWITCHES from:


CREATE OR REPLACE VIEW exu9defpswitches (
??????????????? compflgs, nlslensem ) AS
??????? SELECT? a.value, b.value
??????? FROM??? sys.v$parameter a, sys.v$parameter b
??????? WHERE?? a.name = 'plsql_compiler_flags' AND
??????????????? b.name = 'nls_length_semantics'

to:


CREATE OR REPLACE VIEW exu9defpswitches (
??????????????? compflgs, nlslensem ) AS
??????? SELECT? a.value, b.value
??????? FROM??? sys.v$parameter a, sys.v$parameter b
??????? WHERE?? a.name = 'plsql_code_type' AND
??????????????? b.name = 'nls_length_semantics'

?

(see new parameter PLSQL_CODE_TYPE)

?

3. Re-start exp version 9iR2 to extract from 11g

?

?

4. Import the new dump using imp version 9iR2.

?

验证了下,果然EXP问题解决了,后面IMP也没有问题了。

?

BTW: 从10g开始,oracle主推Data Pump(Expdp/Impdp ),老的exp/imp不再关注了,看来连测试也没有好好测。保密

?