oracle數據庫imp/exp參數介紹


參數:
fromuser具體指定那個用戶下的對象需要導入,所以如果這里使用p_x,會報錯,因為表不在p_x用戶下。
touser具體指定導入那個用戶,該參數必須跟fromuser一起使用。
show在屏幕顯示文件內容,具體不會做導入操作。
ignore忽略導入過程中創建對象的錯誤(確保數據能夠導入),但不會忽略寫入數據的錯誤(如導入的數據跟當前表里的數據有違反唯一性約束的錯誤)。
commit該參數為Y時,導入的過程會提交數據行,若buffer設置得太小,則會過去頻繁的提交數據,對性能有一定的影響。使用commit還有一個好處,就是做測試數據導入時,如果有些錯誤未插入數據庫,使用commit后會將符合的記錄commit提交,不會導致整個導入操作回滾,因為畢竟是做測試,多一些少一些數據問題不是很大。
full導入整個文件。
tables導入表名列表,多個表名,逗號分隔。
rows該參數為Y的時候將導入數據,默認是導入數據。但出於某種原因可以將該參數設置成N即不導入數據行。

 

幾種錯誤的導入:
imp test/***@test tables=(tbl_a,tbl_b) file=tables.dmp log=test.log full=y
提示:
IMP-00024: Only one mode (TABLES, FROMUSER, or FULL) can be specified
TABLES、FROMUSER和FULL參數只能使用一個。

imp test/***@test file=tables.dmp log=test.log ignore=n
提示:
Warning: the objects were exported by P_X, not by you
import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
IMP-00031: Must specify FULL=Y or provide FROMUSER/TOUSER or TABLES arguments
IMP-00000: Import terminated unsuccessfully
FULL=Y、FROMUSER/TOUSER和TABLES參數必須指定其中之一。

imp test/***@test file=tables.dmp log=test.log ignore=n fromuser=user ouser=test
提示:
Warning: the objects were exported by P_X, not by you
import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
IMP-00034: Warning: FromUser "USER" not found in export file
Import terminated successfully with warnings.
說明From User "USER"不包含在dump文件中。但通過這種方式可以找到是哪個用戶使用exp導出的這份dump文件。

imp test/***@test file=tables.dmp log=test.log ignore=n tables=tbl_a
提示:
Warning: the objects were exported by P_X, not by you
import done in ZHS16CGB231280 character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
export server uses UTF8 NCHAR character set (possible ncharset conversion)
. importing P_X's objects into TEST
IMP-00033: Warning: Table "TBL_A" not found in export file
說明TBL_A表並不在導出的dump中,個人認為,因為這里未使用FROMUSER這些參數,默認就是dump中包含的數據是從本地test用戶的,因此這會報錯。


imp test/***@test file=tables.dmp log=test.log ignore=n fromuser=e touser=test(未建立表結構)
imp test/***@test file=tables.dmp log=test.log ignore=y fromuser=e touser=test(已建立表結構)
這里表示刪除了表后,ignore=n,dump的來源是e這個schema或用戶,導入到這個測試test用戶下。

當然,由於test用戶沒有導出庫的一些角色,因此如下這些權限操作可能會失敗,但不影響使用這些測試。
IMP-00017: following statement failed with ORACLE error 1917:
 "GRANT UPDATE ON "TBL_A" TO "B_E""

原文:https://blog.csdn.net/bisal/article/details/24779197
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!


免責聲明!

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



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