exp導(dǎo)出工具將數(shù)據(jù)庫中數(shù)據(jù)備份緊縮成1個2進制系統(tǒng)文件.可以在不同OS間遷移
imp導(dǎo)入工具將EXP構(gòu)成的2進制系統(tǒng)文件導(dǎo)入到數(shù)據(jù)庫中.
1. 導(dǎo)出工具 exp
它有3種模式:
a. 用戶模式: 導(dǎo)出用戶所有對象和對象中的數(shù)據(jù);
b. 表模式: 導(dǎo)出用戶所有表或指定的表;
c. 全部數(shù)據(jù)庫: 導(dǎo)出數(shù)據(jù)庫中所有對象。
$exp oa1/123@oracle file=D:/all.dmp grants=y
說明:把oa1用戶的所有表導(dǎo)出到文件D:/all.dmp
$exp oa1/123@oracle tables=(pfdept,pfuser) file=D:/all.dmp grants=y
說明:把oa1用戶里兩個表emp,dept導(dǎo)出到文件D:/all.dmp
$exp oa1/123@oracle tables=pfdept query="where predeptid=0745" file=D:/all.dmp
說明:在exp里面加上導(dǎo)出pfdept 的查詢條件predeptid=0745
$exp parfile=username.par file=/directory1/username_1.dmp,/directory1/username_2.dmp filesize=2000M log=/directory2/username_exp.log
2.導(dǎo)入工具 imp
有3種模式:
a. 用戶模式: 導(dǎo)出用戶所有對象和對象中的數(shù)據(jù);
b. 表模式: 導(dǎo)出用戶所有表或指定的表;
c. 全部數(shù)據(jù)庫: 導(dǎo)出數(shù)據(jù)庫中所有對象。
$ 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