oracle表結構表數據導入導出


 

 

目錄:

1 exp三種模式(完全、用戶、表)
  1.1 完全模式
  1.2 用戶模式
  1.3 表模式
  1.4 導入example
2 imp三種模式(完全、用戶、表)
  2.1 完全模式
  2.2 用戶模式
  2.3 表模式
  2.4 exp參數
  2.5 導入example

 

 

 

1 imp三種模式(完全、用戶、表)


 

1.1 完全模式

exp system/test buffer=6400 file=c:\test.dmp full=y;

  

1.2 用戶模式

IMP SONIC/SONIC    BUFFER=64000 FILE=C:\SONIC.DMP FROMUSER=SONIC TOUSER=SONIC
//這樣用戶SONIC的所有對象被導入到文件中。必須指定FROMUSER、TOUSER參數,這樣才能導入數據。

  

1.3 表模式

EXP SONIC/SONIC  BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
//這樣用戶SONIC的表SONIC就被導入。

  

 

1.4 導入example

 //將D:\daochu.dmp 中的數據導入 TEST數據庫中。
 imp system/manager@TEST  file=d:\daochu.dmp
 
//上面可能有點問題,因為有的表已經存在,然后它就報錯,對該表就不進行導入。在后面加上 ignore=y 就可以了。
 
//將d:\daochu.dmp中的表table1 導入
 imp system/manager@TEST  file=d:\daochu.dmp  tables=(table1)


imp AML/AML@172.16.87.140:1521/orcl fromuser=URSPMONITOR touser=AML 
  FILE=/data/aml.dmp full=y ignore=y;

create table aml_rule_autoslay_0705 as select * from aml.aml_rule_autoslay;
exp urspmonitor/urspmonitor@10.1.48.53:1521/dwursp file=aml_rule_autoslay.dump tables=aml_rule_autoslay_0705
drop table aml_rule_autoslay_0705;
imp aml/xjnx_ursp_aml1@10.1.51.53:1521/pisa  fromuser=URDPMONITOR touser=aml file=/jgtest/aml_rule_autoslay.dump 
imp aml/xjnx_ursp_aml1@10.1.51.53:1521/pisa  file=/jgtest/aml_rule_autoslay.dump 

  

  

 

 

 

 

 

2 exp三種模式(完全、用戶、表)


 

2.1 完全模式

EXP SYSTEM/MANAGER BUFFER=64000 FILE=C:\FULL.DMP FULL=Y
//如果要執行完全導出,必須具有特殊的權限

  

2.2 用戶模式

EXP SONIC/SONIC    BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC
//這樣用戶SONIC的所有對象被輸出到文件中。

//備份某個用戶模式下的所有對象。業務數據庫通常采用這種備份方式。
  //若備份到本地文件,使用如下命令:
  exp icdmain/icd owner=icdmain rows=y indexes=n compress=n buffer=65536
  feedback=100000 volsize=0
  file=exp_icdmain_yyyymmdd.dmp
  log=exp_icdmain_yyyymmdd.log
  //若直接備份到磁帶設備,使用如下命令:
  exp icdmain/icd owner=icdmain rows=y indexes=n compress=n buffer=65536
  feedback=100000 volsize=0
  file=/dev/rmt0
  log=exp_icdmain_yyyymmdd.log
//注:如果磁盤有空間,建議備份到磁盤,然后再拷貝到磁帶。如果數據庫數據量較小,可采用這種辦法備份。

  

  

2.3 表模式

EXP SONIC/SONIC    BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
//這樣用戶SONIC的表SONIC就被導出

//備份某個用戶模式下指定的對象(表)。業務數據庫通常采用這種備份方式。
exp icdmain/icd rows=y indexes=n compress=n buffer=65536
  feedback=100000 volsize=0
     // 若備份到本地文件
  file=exp_icdmain_csd_yyyymmdd.dmp
     // 直接備份到磁帶設備
      file=/dev/rmt0
  log=exp_icdmain_csd_yyyymmdd.log
  tables=icdmain.commoninformation,icdmain.serviceinfo,icdmain.dealinfo

  

2.4 exp參數

 

 

2.5 導出example

//將數據庫TEST完全導出,用戶名system 密碼manager 導出到D:\daochu.dmp中
exp system/manager@TEST file=d:\daochu.dmp full=y
 
//將數據庫中system用戶與sys用戶的表導出
 exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
 
//將數據庫中的表table1 、table2導出
 exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
 
//將數據庫中的表table1中的字段filed1以"00"打頭的數據導出
 exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\" 

  

  

   

  

1、運到問題?

在導入數據時出現無法找到目標用戶進行賦值錯誤,需要使用fromuser=URSPMONITOR  touser=AML,即忽略用戶授權錯誤;

2、或者使用工具在導入數據面板取消勾選,行數,授權。若出現唯一約束錯誤,取消“約束”勾選;

 

另外可參考:https://www.cnblogs.com/songdavid/articles/2435439.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM