oracle 資料幫浦匯入匯出

2021-08-02 03:32:13 字數 1796 閱讀 1796

使用expdp和impdp時應該注重的事項:

1、exp和imp是客戶端工具程式,它們既可以在客戶端使用,也可以在服務端使用。

2、expdp和impdp是服務端的工具程式,他們只能在oracle服務端使用,不能在客戶端使用。

3、imp只適用於exp匯出的檔案,不適用於expdp匯出檔案;impdp只適用於expdp匯出的檔案,而不適用於exp匯出檔案。

4、對於10g以上的伺服器,使用exp通常不能匯出0行資料的空表,而此時必須使用expdp匯出。

一、準備工作

1)、在備份目的路徑建立備份檔案夾

例如:d:\bak

2)、用sys使用者在oracle中建立邏輯目錄

sql>create directory oraclebak_dir as 『d:\bak』;

3)、檢視資料庫中的邏輯目錄

sql>select * from dba_directories;

4)、授權使用者有對邏輯目錄的讀寫許可權

sql>grant read,write on directory oraclebak_dir to someone;

二、匯出

1)匯出使用者

expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp directory=oraclebak_dir

2)匯出表

expdp scott/tiger@orcl tables=emp,dept dumpfile=expdp.dmp directory=oraclebak_dir

3)按查詢條件導

expdp scott/tiger@orcl directory=oraclebak_dir dumpfile=expdp.dmp tables=emp query=』where deptno=20』

4)按表空間導

expdp system/manager@orcl directory=oraclebak_dir dumpfile=tablespace.dmp tablespaces=temp,example

5)導整個資料庫

expdp system/manager@orcl directory=oraclebak_dir dumpfile=full.dmp full=y

三、匯入資料

1)匯入使用者(從使用者scott匯入到使用者scott)

impdp scott/tiger@orcl directory=oraclebak_dir dumpfile=expdp.dmp schemas=scott

2)匯入表(從scott使用者中把錶dept和emp匯入到system使用者中)

impdp system/manager@orcl directory=oraclebak_dir dumpfile=expdp.dmp tables=scott.dept,scott.emp remap_schema=scott:system

3)匯入表空間

impdp system/manager@orcl directory=oraclebak_dir dumpfile=tablespace.dmp tablespaces=example

4)匯入資料庫

impdb system/manager@orcl directory=oraclebak_dir dumpfile=full.dmp full=y

5)追加資料

impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmp schemas=systemtable_exists_action

參考文件:

oracle 資料幫浦匯入匯出

sqlplus system system egov create directory dump dir as d dbback exit expdp system system egov directory dump dir dumpfile urbanyw.dmp schemas urbanyw...

oracle資料幫浦匯入匯出

使用expdp和impdp時應該注意的事項 exp和imp是客戶端工具程式,它們既可以在客戶端使用,也可以在服務端使用。expdp和impdp是服務端的工具程式,他們只能在oracle服務端使用,不能在客戶端使用。imp只適用於exp匯出的檔案,不適用於expdp匯出檔案 impdp只適用於expd...

oracle資料幫浦匯入匯出

1.建立資料幫浦目錄 create directory home as home expdp 2.授權 grant read,write on directory home to scott 資料字典dba directories 3.匯出 全庫匯出 expdp system oracle comp...