Oracle exp/imp匯出匯入工具的使用-1,expimp
exp匯出工具將資料庫中資料備份壓縮成一個二進位系統檔案.可以在不同OS間遷移
imp匯入工具將EXP形成的二進位系統檔案匯入到資料庫中.
一. 匯出工具 exp
它有三種模式:
a. 使用者模式: 匯出使用者所有對象以及對象中的資料;
b. 表模式: 匯出使用者所有表或者指定的表;
c. 整個資料庫: 匯出資料庫中所有對象。
$exp oa1/123@oracle file=D:/all.dmp grants=y
說明:把oa1使用者的所有表匯出到檔案D:/all.dmp
$exp oa1/123@oracle tables=(pfdept,pfuser) file=D:/all.dmp grants=y
說明:把oa1使用者裡兩個表emp,dept匯出到檔案D:/all.dmp
$exp oa1/123@oracle tables=pfdept query="where predeptid=0745" file=D:/all.dmp
說明:在exp裡面加上匯出pfdept 的查詢條件predeptid=0745
$exp parfile=username.par file=/directory1/username_1.dmp,/directory1/username_2.dmp filesize=2000M log=/directory2/username_exp.log
二.匯入工具 imp
有三種模式:
a. 使用者模式: 匯出使用者所有對象以及對象中的資料;
b. 表模式: 匯出使用者所有表或者指定的表;
c. 整個資料庫: 匯出資料庫中所有對象。
$ imp system/oracle fromuser=oa1 tables=(pfdept)
$ imp system/oracle fromuser=oa1 tables=(pfdept,pfuser)
$ imp system/oracle fromuser=oa1 touser=system
$ imp oa1/123 file = all.dmp full=y
$ imp oa1/123 file = all.dmp show=n buffer=2048000 ignore=n commit=y grants=y full=y log=D:/.log