>  기사  >  데이터 베이스  >  expdp/impdp做Oracle 10g 到11g的数据迁移

expdp/impdp做Oracle 10g 到11g的数据迁移

WBOY
WBOY원래의
2016-06-07 17:28:461065검색

expdp/impdp做Oracle 10g 到11g的数据迁移,导入的时候会提示一个ORA-31684: Object type USER:XXX already exists.这个没关系.

原库版本:Oracle 10.2.0.4.0

目标库版本:Oracle 11.2.0.1.0

使用expdp导出原库数据:

expdp system/xxxxxx schemas=test1201 directory=easbak dumpfile=test1201.dmp logfile=zytest1201.log;

impdp前准备:

1:确保目标数据库和原库字符集一致

2:创建好所需表空间,可以在原库里查询test1201这个用户使用了哪些表空间查询语句如下:

select distinct tablespace_name from dba_segments where owner='TEST1201';

然后创建好表空间,临时表空间就不需要创建了

create tablespace EAS_D_TEST1201_STANDARD datafile '/u01/app/oracle/oradata/orcl/EAS_D_TEST1201_STANDARD.dbf' size 8000m autoextend on next 100m maxsize unlimited autoallocate;

create tablespace EAS_D_TEST1201_TEMP2 datafile '/u01/app/oracle/oradata/orcl/EAS_D_TEST1201_TEMP2.dbf' size 800m autoextend on next 10m maxsize unlimited autoallocate;

3:表空间创建好之后,就需要创建用户了,并需要给用户授权,权限和原库用户的权限保持一致

创建用户:

create user test1201 identified by kingdee default tablespace EAS_D_TEST1201_STANDARD quota unlimited on EAS_D_TEST1201_STANDARD quota unlimited on EAS_D_TEST1201_TEMP2;

查询原库用户的权限:

select * from dba_sys_privs where grantee='TEST1201';

然后给用户授权:

grant CREATE VIEW,CREATE SEQUENCE,UNLIMITED TABLESPACE,SELECT ANY DICTIONARY,CREATE PROCEDURE,CREATE TABLE,CREATE TRIGGER,CREATE MATERIALIZED VIEW,CREATE SESSION to test1201;

4:创建directory,并给用户授予读写权限:

create or replace directory orabak as '/u01/app/orabak';

grant write,read on directory orabak to test1201;

前面的4个点做好之后就开始导入数据了:

将上面导出的文件拷贝到 orabak的这个目录里然后开始导入

impdp system/xxxxxx schemas=test1201 dumpfile=test1201.dmp logfile=expdp_test11.log directory=orabak table_exists_action=replace job_name=my_job6;

导入的时候会提示一个ORA-31684: Object type USER:"XXX" already exists.这个没关系.然后看日志有无其他报错,,如果没有就成功了。

linux

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.