Linux 中 Oracle dmp 文件導入導出


   對於本機安裝了oracle 客戶端,下述命令都可以在 dos 執行,當然 dmp 文件導出在本地。

   但在實際研發時,沒人願意在本機上安裝龐大的 oracle 軟件,這時你需要使用 Xshell/puTTY..

   遠程工具連接到 Linux 進行操作,進行 Linux 上 dmp 文件的導入導出(以下導入導出路徑替換為 Linux 路徑)。

a. 將用戶 system 用戶表導出到指定路徑 D 盤

exp system/password@SID file=d:/daochu.dmp full=y 

b. 將用戶 system 與 sys 用戶的表導出到指定路徑 D 盤

exp system/password@SID file=d:/daochu.dmp owner=(system,sys) 

c. 將用戶 system 中的表 table_A、table_B 導出到指定路徑 D 盤

exp system/password@SID file= d:/daochu.dmp tables=(table_A,table_B) 

d. 將用戶 system 中的表 table1 中的字段 filed1 以"00"打頭的數據導出

exp system/passwor@SID filed=d:/daochu.dmp tables=(table1) query=/" where filed1 like '00%'/" 

   對於壓縮可以用 winzip 將 dmp 文件進行壓縮,也可以在上面命令后面 加上 compress=y 來實現。

   導出 DMP文件適用於大型數據庫完整遷移,對遷移前后兩者服務器數據庫字符集要求一致,且對CLOB字段支持不太友好。

   對於小數據的導出其實用 PLSQL 能做的更好,更快,導出的SQL也很直觀。

e. 將 D:/daochu.dmp 中的數據導入 TEST 數據庫中。

imp system/password@SID file=d:/daochu.dmp 
imp system/password@HUST full=y file=d:/data/newsmgnt.dmp ignore=y 

   上面命令如果出現問題,假設有的表已存在,對該表可以不進行導入,后面添加 ignore=y。 

f. 將 d:/daochu.dmp中的表table1 導入

imp system/passord@SID file=d:/daochu.dmp tables=(table1)

 g.不同用戶不同表空間的數據導入

impdp user2/pass2 directory=dumpdir dumpfile=user1.dmp remap_schema=user1:user2 remap_tablespace=user1:user2

1.remap_user 重新映射用戶,格式:

source_user1:target_user1,source_user2:target_user2

2.remap_tablespace 重新映射表空間

remap_tablespace=tbs_a:tbs_b 

3.remap_schema 重新映射數據歸屬用戶

remap_schema=A:B

4.table_exists_action 表已經存在的動作 有效關鍵字: (SKIP), APPEND, REPLACE 和 TRUNCATE。
5.exclude=object_grant 跳過對象授權

 


免責聲明!

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



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