Oracle生產環境RMAN備份指令碼

來源:互聯網
上載者:User

題記:這裡分享一下我們Oracle的備份指令碼,這些指令碼均在生產庫運行,正確無誤!

環境:SUSE Linux 10sp2 + Oracle 11gR1

說明:小型庫一般都是每周做一次全備,大型庫每周也做一次全備外,周三做1級增量備份,然後每天晚上都做一次2級增量備份,歸檔日誌每天分不同時段定時備份!

--------------------------------------分割線 --------------------------------------

推薦閱讀:

RMAN 配置歸檔日誌刪除策略

Oracle基礎教程之通過RMAN複製資料庫

RMAN備份策略制定參考內容

RMAN備份學習筆記

OracleDatabase Backup加密 RMAN加密

--------------------------------------分割線 --------------------------------------

小型庫全備:
 run {
  # Hot database level 0 whole backup
  allocate channel t1 type disk;
  backup
      incremental level 0
      skip inaccessible
      format '/backup/osedb_osedb01/data/back_%s_%p_%T_%d'
  #AS COMPRESSED backupset
  database plus archivelog
  format '/backup/osedb_osedb01/arch/arclogback_%s_%p_%t_%d'
  delete input;
  delete obsolete;
  release CHANNEL t1 ;
 }

 

大庫全備:
 oracle@subsdb1:~/bin/incre_bakup_cmd> cat backup_db_level0.cmd
 run {
  # Hot database level 0 whole backup
  allocate channel t1 type disk maxpiecesize=50G;
  allocate channel t2 type disk maxpiecesize=50G;
  allocate channel t3 type disk maxpiecesize=50G;
  backup as compressed backupset
      incremental level 0 tag 'subsdb_level0'
      skip inaccessible
      format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_%p_db_level0'
  #AS COMPRESSED backupset
  database
  plus archivelog
  format '/backup/subsdb_subsdb1/arch/arclogback_%s_%p_%t_%d'
  delete input;
  backup current controlfile format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_ctl.ctl';
  release channel t1;
  release channel t2;
  release channel t3;
  delete noprompt obsolete;
 }

1級增量備份:
 oracle@subsdb1:~/bin/incre_bakup_cmd> cat backup_db_level1.cmd
 run {
  # Hot database level 1 whole backup
  allocate channel t1 type disk maxpiecesize=50G;
  allocate channel t2 type disk maxpiecesize=50G;
  allocate channel t3 type disk maxpiecesize=50G;
  backup as compressed backupset
      incremental level 1 tag 'subsdb_level1'
      skip inaccessible
      format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_%p_db_level1'
  #AS COMPRESSED backupset
  database plus archivelog
  format '/backup/subsdb_subsdb1/arch/arclogback_%s_%p_%t_%d'
  delete input;
  backup current controlfile format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_ctl.ctl';
  release channel t1;
  release channel t2;
  release channel t3;
  delete noprompt obsolete;
 }

2級增量備份:
 oracle@subsdb1:~/bin/incre_bakup_cmd> cat backup_db_level2.cmd
 run {
  # Hot database level 2 whole backup
  allocate channel t1 type disk maxpiecesize=50G;
  allocate channel t2 type disk maxpiecesize=50G;
  allocate channel t3 type disk maxpiecesize=50G;
  backup as compressed backupset
      incremental level 2 tag 'subsdb_level2'
      skip inaccessible
      format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_%p_db_level2'
  #AS COMPRESSED backupset
  database
  plus archivelog
  format '/backup/subsdb_subsdb1/arch/arclogback_%s_%p_%t_%d'
  delete input;
  backup current controlfile format '/backup/subsdb_subsdb1/data/bak_%d_%T_%s_ctl.ctl';
  release channel t1;
  release channel t2;
  release channel t3;
  delete noprompt obsolete;
 }


歸檔記錄備份:
 cat backup_arch.cmd
 run {

  allocate channel t1 type disk;
  backup
    skip inaccessible
    format '/backup/osedb_osedb01/arch/arclogback_%s_%p_%t_%d'
    #AS COMPRESSED backupset
    (archivelog all delete input);
    delete obsolete;
  release CHANNEL t1 ;
 }

聯繫我們

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