rman系列之在window平台和linux平台上rman的自動備份

來源:互聯網
上載者:User

    無論是哪個平台,都需要先明確我們的目標:

    1)每天夜間1點執行

    2)資料庫全備,同時備份控制檔案和歸檔記錄檔,備份檔案儲存到/u01/app/oracle/backup/目錄下,並且,在完成歸檔記錄檔備份後,自動刪除已備份的歸檔日誌

    3)備份保留14天,到期自動刪除

    4)保留rman動作記錄

    先來實現在window平台

    編寫rman批次檔

run{configure retention policy to recovery window of 14 days;configure controlfile autobackup on;configure controlfile autobackup format for device type disk to '/u01/app/oracle/backup/%F';allocate channel c1 device type disk format '/u01/app/oracle/backup/bak_%U';backup database skip inaccessible plus archivelog filesperset 20 delete all input;release channel c1;}crosscheck backupset;delete noprompt obsolete;

    儲存至D:\oracle\script\backup\db_fullbak_think.rman

    注釋:skip inaccessible:跳過不可讀的檔案

               skip offline:跳過離線檔案

               skip readonly:跳過唯讀資料檔案

               filesperset:用來限定每類備份組最多可包含的檔案。在本例,filesperset出現在備份歸檔的子句中,因此用來限制每個歸檔備份組最多隻能包含20個歸檔檔案。

    編寫命令執行rman批次檔

set ORACLE_SID=orclrman target / log d:\oracle\script\backup\logs\bak_%DATE:~0,10%.LOG CMDFILE=D:\oracle\script\backup\db_fullbak_think.rman

    將上述內容儲存至D:\oracle\script\backup\db_fullbak_think.bat

    設定執行計畫

    開啟”控制台“--->"任務計劃”-->"新增工作計劃“

    *******************************linux平台如下*********************************

    win和linux上rman的自動備份,其實差異不大,rman批處理指令碼無須多大變動。唯一差別就是linux上是用crontab來進行自動備份的。

    在crontab裡面:

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1ORACLE_BASE=/u01/app/oracleORACLE_SID=orcl* * * * *  /u01/app/oracle/product/10.2.0/db_1/bin/rman target / cmdfile='/home/oracle/rmanbackupusers.rcv'

      對於crontab的使用,請見:http://blog.csdn.net/linwaterbin/article/details/7661552

   

相關文章

聯繫我們

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