對imp中的fromuser參數的偏差理解,impfromuser
這兩天執行匯入dump檔案時總碰到一個問題。
問題現象:
1. 執行:imp xyz/xxx file=test.dmp log=imp_test.log fromuser=test1 touser=test2ignore=y commit=y buffer=300000000 feedback=10000
註:這個檔案dump>200G容量。
2. 執行了許久,但最後結果和log中記錄:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
Export file created by EXPORT:V10.02.01 via conventional path
Warning: the objects were exported by TEST1, not by you
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing TEST1's objects into TEST2
Import terminated successfully without warnings.
3. 但沒有任何dump中的資料匯入到test2使用者中。
原因分析:
首先,其實是對imp命令中的fromuser參數偏差的理解。
[root@vm-vmw4131-t ~]# imp -help
FROMUSER list of owner usernames
imp指令協助中說明FROMUSER的含義是“屬主使用者名稱列表”,相應的,從exp指令協助中可以看到OWNER參數表示的是相同的含義:
[root@vm-vmw4131-t ~]# exp -help
OWNER list of owner usernames
即該使用者指的是對象所屬使用者。
其次,經過諮詢,上述問題中用到的fromuser=test1這個test1使用者是執行exp的系統賬戶,並不是資料庫物件所屬賬戶,這就能解釋上面問題的原因了:由於dump檔案所屬的資料對象賬戶是另外一個賬戶,不是test1,因此使用imp ... fromuser=test1時,會檢索這個檔案dump,尋找屬於test1使用者的對象,全檔案掃描後,根本沒有屬於該使用者的對象,因此提示“Import terminated successfully without warnings”正常結束。
總結:
1. 這次匯入匯出時可能根本沒實際考慮LANG等字元集環境變數。
2. imp的fromuser指的是對象所屬使用者,不是執行exp匯出的使用者。
oracle imp 採用 fromuser touser 的模式,提示“正在將 xxx 的對象匯入到 xxx”;
木事的,最大可能是表太大,表上有索引,並且索引也不小
在dos中將資料庫資料匯入oracle時,報這樣的錯: IMP-00034:警告:在匯出檔案中未找到FromUser"IIMS"
我一般這樣匯入的
imp 新使用者名稱/密碼@服務名 file=需要匯入的檔案 fromuser=資料庫檔案的匯出使用者名稱 touser=新使用者名稱 log=就匯入全過程的日誌
如果還有疑問,可執行imp help=y 查看更多的參數