Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 17:28:46
Original
1064 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!