以下代码保存为.sh文件,并放到crontab里就可以实现自动清理
代码如下:
#!/bin/sh
export BACK_DATE=`date +%Y%m%d`
export BACKUP_PATH=/home/oracle/dbbak
echo `mkdir -p ${BACKUP_PATH}/archivelog/${BACK_DATE}`
rman msglog=$BACKUP_PATH/archivelog/${BACK_DATE}/arch_0_$BACK_DATE.log << EOF
connect target /;
delete expired archivelog all;
delete noprompt archivelog until time ‘sysdate – 1’ ;
exit
EOF
版权声明:本文为shopju原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。