Oracle exp/imp 導入導出命令

jopen 10年前發布 | 9K 次閱讀 Oracle 數據庫服務器

(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

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!