oracle 數據泵導入導出


oracle 數據泵導入導出

使用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)導入數據庫 
impdp 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

參考文檔: 
http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_export.htm#i1007509

http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_import.htm#g1025464

 

轉自https://blog.csdn.net/tmtongming/article/details/72865512


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM