Oracle用数据泵转移SCHEMA(不同版本数据库)

11g上创建测试数据

SYS@ prod> create tablespace testtbs datafile size 10m ;
 
Tablespace created.
 
SYS@ prod> create user testuser default tablespace testtbs identified by testuser ;
 
User created.
 
SYS@ prod> grant connect , resource to testuser ;
 
Grant succeeded.
 
SYS@ prod> grant all on directory dumpdir to testuser ;
 
Grant succeeded.
 
SYS@ prod> create table testuser.test as select * from scott.emp ;
 
Table created.

11g上导出:

[oracle@dbsvr1 ~]$ expdp testuser/testuser directory=dumpdir schemas=testuser dumpfile=tttt.dmp version=10.2.0.1

 

10g上创建用户:

SYS@ prod> create directory dumpdir as '/home/oracle/' ;
 
Directory created.
 
SYS@ prod> create user testuser identified by testuser ;
 
User created.
 
SYS@ prod> grant connect , resource to testuser ;
 
Grant succeeded.
 
SYS@ prod> grant all on directory dumpdir to testuser ;
 
Grant succeeded.


10g上导入:

[oracle@db10g ~]$ impdp testuser/testuser remap_tablespace=testtbs:users directory=dumpdir dumpfile=tttt.dmp

 

注意两点:

版本不同导出时加version参数。

如果表原来所在的表空间在新的数据库上不存在,需要remap_tablespace参数。格式是旧:新。

 

如果是从10g向11g导数据则不需要version参数。

你可能感兴趣的:(数据库技术)