天天看點

oracle導入導出整理(二)

3.  三種模式 
(1)表方式,将指定表的資料導出/導入。
  導出:
   導出一張或幾張表:
  $ exp user/[email protected] file=/dir/xxx.dmp log=xxx.log tables=table1,table2
注:user/[email protected]:要導出的使用者名/密碼@SID名
File :導出轉儲檔案的名字
tables:要導出的一系清單;執行這些表的TABLE導出操作
導入:
 導入一張或幾張表

$  imp  user/[email protected]  file=/dir/xxx.dmp  log=xxx.log  tables=table1,table2  fromuser=dbu ser touser=dbuser2 commit=y ignore=y
 注:user/[email protected]:要導入的使用者名/密碼@SID名
fromuser : 在FULL=N的情況下,才有參數。它是一系列的資料庫帳号,其對象應從導出轉儲檔案中讀取
touser : 一系列資料庫帳号,導出轉儲檔案扣的對象将要導入這些帳号
Commit:   送出數組插入 (N) 
 Ignore:  忽略建立錯誤
(2)使用者方式,将指定使用者的所有對象及資料導出/導入。
  導出:
    $ exp user/[email protected] file=/dir/xxx.dmp log=xxx.log owner=(xx, yy)
  隻導出資料對象,不導出資料  (rows=n )
注:user/[email protected]:要導出的使用者名/密碼@SID名
Owner : 要導出的一系列資料庫帳号,然後執行這些帳号的USER導出操作
Log:導出日志将要寫入的檔案的名字
Rows : 是否應導出行。如它為‘N’,那麼在導出檔案中僅生成資料庫對象的DDL
   $ exp user/[email protected] file=/dir/xxx.dmp log=xxx.log owner=user rows=n
  導入:
$ imp user/[email protected] file=/dir/xxx.dmp log=xxx.log fromuser=dbuser touser=dbuser2  commit=y ignore=y
 注:user/[email protected]:要導入的使用者名/密碼@SID名
File :導入轉儲檔案的名字
     Log : 導入日志将要寫入的檔案的名字
     fromuser : 在FULL=N的情況下,才有參數。它是一系列的資料庫帳号,其對象應從導出轉儲檔案中讀取
touser : 一系列資料庫帳号,導出轉儲檔案扣的對象将要導入這些帳号