溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Oracle11g數(shù)據(jù)庫遷移到Oracle12C的PDB(使用impdp/expdp)

發(fā)布時(shí)間:2020-07-05 21:13:13 來源:網(wǎng)絡(luò) 閱讀:22861 作者:PengChonggui 欄目:關(guān)系型數(shù)據(jù)庫

Oracle11g數(shù)據(jù)庫遷移到Oracle12C的PDB(使用impdp/expdp)
alter pluggable database hrdb close immediate;
DROP PLUGGABLE DATABASE hrdb INCLUDING DATAFILES;  

--一、數(shù)據(jù)備份
mkdir /oradata/dumpdir
--創(chuàng)建目錄
create or replace directory exp_dir as '/oradata/dumpdir';
--授權(quán)
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;


---二、數(shù)據(jù)導(dǎo)入Oracle12C
--登錄cpcdb
$sqlplus sys/Oracleedw13@192.168.2.218:1531/hrdb as sysdba

--創(chuàng)建目錄
create or replace directory exp_dir as '/oradata/dumpdir';
--授權(quán)
grant read,write on directory exp_dir to hradm;



--查詢
select * from dba_directories;

--創(chuàng)建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授權(quán),并修改默認(rèn)表空間
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導(dǎo)入hrdb數(shù)據(jù)

impdp admin@hrdb 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:現(xiàn)在的schema
 transform=segment_attributes:n 去掉表空間和存儲(chǔ)子句,加上這個(gè)參數(shù)后,remap_tablesapce參數(shù)就會(huì)失效,就會(huì)倒進(jìn)用戶默認(rèn)的表空間,




向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI