Oracle資料庫IMP/EXP命令的使用

來源:互聯網
上載者:User

  1. 匯出資料庫的操作如下:   
  2. 在命令列中輸入cmd,進入DOS視窗。   
  3. 直接輸入exp ccsbi/ccsbi_jyfx@ccsbi_55 file=d:daochu.dmp ignore=y   
  4. 即可匯出整個資料庫。   
  5.   
  6. 資料匯出:   
  7.  1 將資料庫TEST完全匯出,使用者名稱system 密碼manager 匯出到D:daochu.dmp中   
  8.    exp ccsbi/ccsbi_jyfx@ccsbi_55 file=d:daochu.dmp full=y   
  9.  2 將資料庫中system使用者與sys使用者的表匯出   
  10.    exp ccsbi/ccsbi_jyfx@ccsbi_55 file=d:daochu.dmp owner=(system,sys)   
  11.  3 將資料庫中的表inner_notify、notify_staff_relat匯出   
  12.     exp aichannel/aichannel@TESTDB2 file= d:datanewsmgnt.dmp tables=   
  13.   
  14. (inner_notify,notify_staff_relat)    
  15.   
  16.  4 將資料庫中的表table1中的欄位filed1以"00"打頭的資料匯出   
  17.    exp system/manager@TEST file=d:daochu.dmp tables=(table1) query=" where filed1 like '00%'"  
  18.   
  19.   上面是常用的匯出,對於壓縮,既用winzip把dmp檔案可以很好的壓縮。   
  20.   也可以在上面命令後面 加上 compress=y 來實現。   
  21.   
  22. 資料的匯入   
  23.  1 將D:daochu.dmp 中的資料匯入 TEST資料庫中。   
  24.    imp system/manager@TEST  file=d:daochu.dmp   
  25.    imp aichannel/aichannel@HUST full=y  file=d:datanewsmgnt.dmp ignore=y   
  26.    上面可能有點問題,因為有的表已經存在,然後它就報錯,對該表就不進行匯入。   
  27.    在後面加上 ignore=y 就可以了。   
  28.  2 將d:daochu.dmp中的表table1 匯入   
  29.  imp system/manager@TEST  file=d:daochu.dmp  tables=(table1)   
  30.     
  31.  基本上上面的匯入匯出夠用了。不少情況要先是將表徹底刪除,然後匯入。   
  32.     
  33. 注意:   
  34.  操作者要有足夠的許可權,許可權不夠它會提示。   
  35.  資料庫時可以連上的。可以用tnsping TEST 來獲得資料庫TEST能否連上。   
  36.   
  37. 附錄一:   
  38.  給使用者增加匯入資料許可權的操作   
  39.  第一,啟動sql*puls   
  40.  第二,以system/manager登陸   
  41.  第三,create user 使用者名稱 IDENTIFIED BY 密碼 (如果已經建立過使用者,這步可以省略)   
  42.  第四,GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW ,   
  43.    DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,   
  44.       DBA,CONNECT,RESOURCE,CREATE SESSION  TO 使用者名稱字   
  45.  第五, 運行-cmd-進入dmp檔案所在的目錄,   
  46.       imp userid=system/manager full=y file=*.dmp   
  47.       或者 imp userid=system/manager full=y file=filename.dmp   
  48.   
  49.  執行樣本:   
  50.  F:WorkOracle_Databackup>imp userid=test/test full=y file=inner_notify.dmp   
  51.   
  52. 螢幕顯示   
  53. Import: Release 8.1.7.0.0 - Production on 星期四 2月 16 16:50:05 2006  
  54. (c) Copyright 2000 Oracle Corporation.  All rights reserved.   
  55.   
  56. 串連到: Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production   
  57. With the Partitioning option   
  58. JServer Release 8.1.7.0.0 - Production   
  59.   
  60. 經由常規路徑匯出由EXPORT:V08.01.07建立的檔案   
  61. 已經完成ZHS16GBK字元集和ZHS16GBK NCHAR 字元集中的匯入   
  62. 匯出伺服器使用UTF8 NCHAR 字元集 (可能的ncharset轉換)   
  63. . 正在將AICHANNEL的對象匯入到 AICHANNEL   
  64. . . 正在匯入表                  "INNER_NOTIFY"          4行被匯入   
  65. 準備啟用約束條件...   
  66. 成功終止匯入,但出現警告。   
  67.   
  68.     
  69. 附錄二:   
  70.  Oracle 不允許直接改變表的擁有者, 利用Export/Import可以達到這一目的.   
  71.   先建立import9.par,   
  72.   然後,使用時命令如下:imp parfile=/filepath/import9.par   
  73.   例 import9.par 內容如下:   
  74.         FROMUSER=TGPMS          
  75.         TOUSER=TGPMS2     (註:把表的擁有者由FROMUSER改為TOUSER,FROMUSER和TOUSER的使用者可以不同   
  76.   
  77. )             
  78.         ROWS=Y   
  79.         INDEXES=Y   
  80.         GRANTS=Y   
  81.         CONSTRAINTS=Y   
  82.         BUFFER=409600  
  83.         file==/backup/ctgpc_20030623.dmp   
  84.         log==/backup/import_20030623.log    
  85.   
  86. 備忘:   
  87. 1.在匯入匯出命令中加上feedback=1000可以讓過程顯示一個不斷增多的“...”,以改變以往的閃爍的游標  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.