【Vegas原创】RMAN数据库Daily备份脚本(Linux版)

2年前 (2022) 程序员胖胖胖虎阿
231 0 0
例:添加oralin数据库每日RMAN备份

1,添加/u03/script/oralin/fullbak.sh

#!/bin/sh
echo "`date` 
backup start"
$ORACLE_HOME
/bin/rman target / nocatalog <<EOF
run{
allocate channel c1 type 
disk;
allocate channel c2 type 
disk;
allocate channel c3 type 
disk;
backup  format '/u03/dmp/oralin/dbfile/full%u_%s_%p' database
include 
current controlfile;
sql 
'alter system archive log current';
backup filesperset 3 format '/u03/dmp/oralin/log/arch%u_%s_%p'
archivelog 
all delete input;
release channel c1;
release channel c2;
release channel c3;
}
EOF
echo "`date` 
backup successful"
exit;


2,添加/u03/script/oralin/delobsolete.sh

$ORACLE_HOME/bin/rman target / nocatalog <<EOFi
run{
crosscheck archivelog 
all;
crosscheck 
backup;
delete noprompt obsolete;
}


3,crontab -e,添加:

00 03 * * * su - oracle -c "sh /u03/script/oralin/fullbak.sh">/u03/script/oralin/full.log
00 07 * * * su - oracle -c "sh /u03/script/oralin/delobsolete.sh">/u03/script/oralin/delobsolete.log

 

相关文章

暂无评论

暂无评论...