【Vegas原创】RMAN数据库Daily备份脚本(Windows版)
例:RMAN备份每日的orawin数据库:
1,新建backup.cmd:
2,在上一步骤指定的路径下新建backupfull.sql:
3,打开控制面板,新增每日计划,设定好时间,即可。
1,新建backup.cmd:
set oracle_sid=orawin
rman target / nocatalog cmdfile=F:\Script\orawin\backupfull.sql log=F:\Script\orawin\backupfull.log append
rman target / nocatalog cmdfile=F:\Script\orawin\backupfull.sql log=F:\Script\orawin\backupfull.log append
2,在上一步骤指定的路径下新建backupfull.sql:
run {
set command id to 'rman';
allocate channel dev1 type disk;
backup
format 'F:\rmanbak\orawin\df%s_%p_%t'
database include current controlfile;
sql 'alter system archive log current';
sql 'alter system archive log current';
delete noprompt obsolete;
backup
filesperset 20
format 'F:\rmanbak\orawin\Log\ar%s_%p_%t'
(archivelog until time '(SYSDATE-1)' all delete input);
delete noprompt obsolete;
release channel dev1;
}
set command id to 'rman';
allocate channel dev1 type disk;
backup
format 'F:\rmanbak\orawin\df%s_%p_%t'
database include current controlfile;
sql 'alter system archive log current';
sql 'alter system archive log current';
delete noprompt obsolete;
backup
filesperset 20
format 'F:\rmanbak\orawin\Log\ar%s_%p_%t'
(archivelog until time '(SYSDATE-1)' all delete input);
delete noprompt obsolete;
release channel dev1;
}
3,打开控制面板,新增每日计划,设定好时间,即可。
喜欢请赞赏一下啦^_^