Oracle資料泵匯出匯入(expdp/impdp)

tandongmu發表於2018-05-30

一、建立表空間

create tablespace atp
logging
datafile `D:oracleoradataorclatp.dbf`
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

二、建立使用者

— Create the user
create user ATP
default tablespace ATP
temporary tablespace TEMP
profile DEFAULT
identified by atp;
— Grant/Revoke role privileges
grant connect to ATP;
grant dba to ATP;
grant resource to ATP;
— Grant/Revoke system privileges
grant create any view to ATP;
grant select any sequence to ATP;
grant select any table to ATP;
grant unlimited tablespace to ATP;

三、匯出

1、建立邏輯目錄,該命令不會在作業系統建立真正的目錄,最好以system等管理員建立。
create directory expdp_dir as `D:homeOracledump`;
2、給scott使用者賦予在指定目錄的操作許可權,最好以system等管理員賦予。
grant read,write on directory expdp_dir to scott;
3、在windows中建立目錄“D:homeOracledump”
4、匯出命令
1)按使用者匯出:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log schemas=netobdc
2)按表名匯出:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log TABLES=emp,dept
3)匯出整個資料庫:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log FULL=y

四、匯入

1、建立邏輯目錄,該命令不會在作業系統建立真正的目錄,最好以system等管理員建立。
create directory impdp_dir as `D:homeOracleimpdp_dir`;
2、給scott使用者賦予在指定目錄的操作許可權,最好以system等管理員賦予。
grant read,write on directory impdp_dir to scott;
3、在windows中建立目錄“D:homeOracleimpdp_dir”然後將匯出的dmp包拷貝到此目錄下
4、匯入命令
1)匯入到指定使用者下:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log schemas=bdc_atp
2)匯入到不同的使用者下:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log remap_schema=atp:bdc_atp
3)匯入整個資料庫:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log FULL=y

相關文章