#!/usr/bin/ksh
today=`date +%d`
last_day=`cal | xargs | awk '{print $NF}'`
if [ "$today" = "$last_day" ]; then
exit 1
fi
. /home/oracle/.profile
vdat=`date +%Y%m%d`
mkdir -p /rmanbackup/$vdat
mkdir -p /rmanbackup/$vdat
logfile=/rmanbackup/$vdat/fullbackup_$vdat.log
rman target / nocatalog log=$logfile
run
{
ALLOCATE CHANNEL ch1 DEVICE TYPE disk;
ALLOCATE CHANNEL ch2 DEVICE TYPE disk;
ALLOCATE CHANNEL ch3 DEVICE TYPE disk;
ALLOCATE CHANNEL ch4 DEVICE TYPE disk;
backup as compressed backupset database format '/rmanbackup/$vdat/fullbackup_%u.bak' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/rmanbackup/$vdat/archbackup_%u.bak';
backup current controlfile format '/rmanbackup/$vdat/ctl_%d_%T.bak';
backup spfile format '/rmanbackup/$vdat/SPFILE_%T_%s_%p.bak';
crossc
Oracle RMAN备份和清理过期归档的通用脚本
最新推荐文章于 2025-05-08 11:02:28 发布