exp/imp與expdp/impdp區別

lwitpub發表於2009-09-21

一、用法區別

1:把使用者usera的物件導到使用者userb,用法區別在於fromuser=usera touser=userb ,remap_schema='usera':'usera' 。例如:imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;
impdp system/passwd directory=expdp dumpfile=expdp.dmp remap_schema='usera':'userb' logfile=/oracle/exp.log;

2:更換表空間,用exp/imp的時候,要想更改表所在的表空間,需要手工去處理一下,
如alter table xxx move tablespace_new之類的操作。
用impdp只要用remap_tablespace='tabspace_old':'tablespace_new'

3:當指定一些表的時候,使用exp/imp 時,tables的用法是 tables=('table1','table2','table3')。
expdp/impdp的用法是tables='table1','table2','table3'

4:是否要匯出資料行
exp (ROWS=Y 匯出資料行,ROWS=N 不匯出資料行)
expdp content(ALL:物件+匯出資料行,DATA_ONLY:只匯出物件,METADATA_ONLY:只匯出資料的記錄)

5:expdp是10g的新特性而且只能在伺服器執行。而exp/imp是通用的。

二、效率比較

測試條件:單個表測試,1363292行記錄,116.6 MB左右資料量。

使用並行expdp花費時間約43秒,語句:expdp scott/oracle dumpfile=big_table.dmp directory=dpdata tables=big_table job_name=exptab parallel=4

使用正常的expdp(無parallel=4),花費時間約34秒,並行的差異可能需要更大資料量的測試。

exp直接路徑匯出約71秒,語句:exp scott/oracle file=big_table3.dmp tables=big_table direct=y
exp常規路徑(無direct=y)匯出,約126秒,花費時間最長。

從效率比較上看,expdp是一般exp的4倍左右。而匯出的檔案大小,傳統方式exp檔案要大於expdp的檔案大小,大約大出10M左右。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/628922/viewspace-615132/,如需轉載,請註明出處,否則將追究法律責任。

相關文章