Oracle資料庫之【備份與恢複篇】

來源:互聯網
上載者:User

一、物理備份工具rman(Recovery Manager)

rman功能強大,操作相對複雜一些,對普通的開發人員來說,在日常工作當中一般不需要使用,感興趣的同事可以通過查看Oracle相關的資料瞭解。

二、邏輯備份工具exp & imp

exp & imp工具程式使用簡單、方便,一般與資料庫有關的開發人員都可能要使用到。本課程將主要介紹exp & imp。

三、資料裝載工具SQL Loader

SQL Loader主要用於將文字檔裝載到資料庫中。

下面重點介紹exp & imp
1、使用exp & imp 需要注意的事項
使用exp和imp需要保證伺服器和用戶端的字元集一致,通過exp匯出時,用戶端的版本最好和伺服器一致,通過imp恢複時的資料庫版本不能比原有的資料庫版本低。

  1. --2、備份指定的表  
  2. exp icd/icd@orauidb tables=tbilllog1 rows=y indexes=n file=tbilllog1.dmp  
  3. --3、按使用者備份  
  4. exp icd/icd@orauidb owner=icd feedback=5000 file=icd.dmp  
  5. --4、全庫備份  
  6. exp icd/icd@orauidb feedback=5000 full=y file=full.dmp  
  7. --5、備份指定的資料表空間  
  8. exp icd/icd@orauidb tablespaces=service_core_dat file=service_core_dat.dmp  
  9. --6、按條件匯出  
  10. exp icd/icd@orauidb tables=tbilllog1 query=\"where logdate>to_date('2005-06-01','yyyy-mm-dd')\" file=tbilllog1.dmp  
  11. --7、從備份檔案中恢複指定的表的資料  
  12. imp icd/icd@orauidb tables=tbilllog1 ignore=y feedback=5000 file=icd.dmp  
  13. --8、恢複整個備份檔案  
  14. imp icd/icd@orauidb feedback=5000 full=y file=full.dmp  
下面介紹資料裝載工具SQL Loader
1、基本步驟
使用SQL Loader工具遷移資料一般分為三個步驟:
第一、產生文字檔。
第二、編寫控制檔案。
第三、匯入的命令。
2、編寫控制檔案
LOAD DATA INFILE "D:\t_card_bill.txt"
APPEND INTO TABLE t_Card_bill FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
(uaccountno,billtype, fee, serviceno, fee_date date 'YYYY-MM-DD HH24:MI:SS',
fee_enddate date 'YYYY-MM-DD HH24:MI:SS', caller_number, called_number, duration)
3、匯入的命令
sqlldr username/password@database control=控制檔案所在路徑\控制檔案名稱
readsize=5000000 bindsize=5000000 rows=1000

更多Oracle相關資訊見Oracle 專題頁面 http://www.bkjia.com/topicnews.aspx?tid=12

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.