(1)表方式,將指定表的數據導出/導入。
導出:
導出一張或幾張表:
代碼
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1,table2
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1,table2
如果是分區表
代碼
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1:tablespaces1,table2:tablespaces2
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1:tablespaces1,table2:tablespaces2
導出某張表的部分數據
代碼
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1 query=\”where col1=\’…\’
and col2 \<…\”
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1 query=\”where col1=\’…\’
and col2 \<…\”
導入:
導入一張或幾張表
代碼
$ imp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1,table2 fromuser=dbuser touser=dbuser2 commit=y ignore=y
$ imp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1,table2 fromuser=dbuser touser=dbuser2 commit=y ignore=y
如果是分區表
代碼
$ imp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1:tablespaces1,table2:tablespaces2 fromuser=dbuser touser=dbuser2 commit=y ignore=y
$ imp user/pwd file=/dir/xxx.dmp log=xxx.log tables=table1:tablespaces1,table2:tablespaces2 fromuser=dbuser touser=dbuser2 commit=y ignore=y
(2)用戶方式,將指定用戶的所有對象及數據導出/導入。
導出:
代碼
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log owner=(xx, yy)
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log owner=(xx, yy)
只導出數據對象,不導出數據 (rows=n )
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log owner=user rows=n
導入:
代碼
imp user/pwd file=/dir/xxx.dmp log=xxx.log fromuser=dbuser touser=dbuser2
mmit=y ignore=y
imp user/pwd file=/dir/xxx.dmp log=xxx.log fromuser=dbuser touser=dbuser2
commit=y ignore=y
(3)全庫方式,將數據庫中的所有對象導出/導入導出:
代碼
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log full=ycommit=y ignore=y
$ exp user/pwd file=/dir/xxx.dmp log=xxx.log full=ycommit=y ignore=y
導入:
代碼
$ imp user/pwd file=/dir/xxx.dmp log=xxx.log fromuser=dbuser touser=dbuser2