rman 自動備份指令碼-windows

chicken0915發表於2012-08-09

Ctrl+R
CMD

rem 建立一個每週 一二三四五六七 23:00都執行的計劃,命令如下;
------------------------------------------------------------------------
at 23:00 /every:m,t,w,th,f,s,su Y:\rman.bat
------------------------------------------------------------------------


rem 在Y盤建立一個rman.bat檔案,等待計劃呼叫,
rem 計劃執行rman.txt指令碼,同時在Y盤下生成rman.log日誌
rem 內容如下;
------------------------------------------------------------------------
@echo off
cd /d ORACLE_HOME\BIN\
rman cmdfile=Y:\rman.txt msglog=Y:\rman.log
------------------------------------------------------------------------


rem Y盤建立一個rman.txt指令碼檔案,等待rman.bat呼叫,
rem 指令碼內容
rem 備份資料檔案,
rem 備份控制檔案,
rem 備份歸檔日誌檔案,
rem 刪除備份的歸檔日誌
rem 保留1個有效備份集
rem 內容如下;

檢視或者修改備份集;

RMAN> show retention policy;
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
------------------------------------------------------------------------
connect target /
report obsolete;
delete obsolete;
run {
allocate channel c0 type disk
maxpiecesize = 1024m format 'Y:\oracle\bak\oracle_%U.dblzk';
backup incremental level 0 skip inaccessible tag Backup_Level0 database;
release channel c0;
allocate channel c0 type disk
maxpiecesize = 1024m format 'Y:\oracle\bak\oracle_%U.ctllzk';
backup skip inaccessible tag Backup_Controlfile current controlfile;
release channel c0;
allocate channel c0 type disk
maxpiecesize = 1024m format 'Y:\oracle\bak\oracle_%U.loglzk';
backup archivelog all delete input;
release channel c0;
}
------------------------------------------------------------------------

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7755871/viewspace-740576/,如需轉載,請註明出處,否則將追究法律責任。

相關文章