Oracle11g資料庫遷移到Oracle12C的PDB(使用impdp/expdp)

來源:互聯網
上載者:User

標籤:oracle12c   資料移轉   expdp   impdp   pdb   

Oracle11g資料庫遷移到Oracle12C的PDB(使用impdp/expdp)
alter pluggable database hrdb close immediate;
DROP PLUGGABLE DATABASE hrdb INCLUDING DATAFILES;  

--一、資料備份
mkdir /oradata/dumpdir
--建立目錄
create or replace directory exp_dir as '/oradata/dumpdir';
--授權
grant read,write on directory exp_dir to hradm;

--查詢
select * from dba_directories;

expdp admin/admin file=hr.dmp directory=exp_dir schemas=hradm;

--刪除
drop directory exp_dir;


---二、資料匯入Oracle12C
--登入cpcdb
$sqlplus sys/[email protected]:1531/hrdb as sysdba

--建立目錄
create or replace directory exp_dir as '/oradata/dumpdir';
--授權
grant read,write on directory exp_dir to hradm;



--查詢
select * from dba_directories;

--建立tbscpc資料表空間

create tablespace tbshr
datafile '/oradata/edw/hrdb/hrdb-001.dbf'
size 2G
autoextend on
next 64m maxsize 20G
segment space management auto
extent management local;

alter tablespace tbshr
add datafile '/oradata/edw/hrdb/hrdb-002.dbf' size 2G
autoextend on
next 50m maxsize 20G;

alter tablespace tbshr
add datafile '/oradata/edw/hrdb/hrdb-003.dbf' size 2G
autoextend on
next 50m maxsize 20G;


--給cpcadm和admin授權,並修改預設資料表空間
grant dba,resource to hradm;
select * from dba_users where username='HRADM';
alter user hradm default tablespace tbshr;

alter database default tablespace tbshr;

create user admin identified by admin;
grant connect,dba to admin;

--使用impdp匯入hrdb資料

impdp [email protected] directory=exp_dir dumpfile=hr20180401004000.DMP  remap_tablespace=tbs_hr:tbshr   remap_schema=hr:hradm schemas=hr table_exists_action=replace transform=segment_attributes:n

remap_tablespace=tbs_hr:tbshr  原來資料表空間:新的資料表空間
remap_schema=hr:hradm          原來的schema:現在的schema
 transform=segment_attributes:n 去掉資料表空間和儲存子句,加上這個參數後,remap_tablesapce參數就會失效,就會倒進使用者預設的資料表空間,




Oracle11g資料庫遷移到Oracle12C的PDB(使用impdp/expdp)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.