oracle10gエクスポートを実行する。
データベース全体をEXPORT
$ exp system/manager fully=y
※EXP_FULL_DATABASEロールが必要。
表領域をEXPORT
$ exp system/manager tablespaces=tbls
ユーザーをEXPORT
$ exp username/password owner=username
※指定したユーザーが保有するオブジェクトは、全てEXPORTされる。
テーブルをEXPORT
$ exp username/password tables=emp1,emp2
$ exp username/password tables=emp:prt01
レコードの条件を指定してEXPORTする
$ exp username/password tables=emp query=\”where salary >= 200 \”
※QUERYオプションで、SQL文のWHERE句を指定する。
EXPORTするファイルを指定
$ exp username/password tables=emp file=emp.dmp
※カレントディレクトリに「expdat.dmp」としてエクスポートする。
パラメータ・ファイルの使用
$ exp username/password parfile=export.par
export.par
TABLES=username.table1,username.table2
FILE=expdat.dmp
GRANTS=y
INDEXES=y
CONSISTENT=y
LOG=export.log
異なるユーザーにIMPORT
$ imp system/manager tables=emp fromuser=username touser=otherusername
既に存在するオブジェクトを上書きIMPORT
$ imp username/password tables=emp ignore=y
ファイルを指定でIMPORTする
$ imp username/password tables=emp file=emp.dmp
※カレントディレクトリの「expdat.dmp」
パラメータ・ファイルの使用
$ imp username/password parfile=import.par
import.par
FILE=expdat.dmp
TABLES=(*)
LOG=import.log