expdp/impdp做Oracle 10g 到11g的資料移轉

來源:互聯網
上載者:User

原庫版本: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.這個沒關係.然後看日誌有無其他報錯,如果沒有就成功了。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.