Linux下设置定时任务删除归档日志
1、编辑删除归档日志的脚本----/home/oracle/clearlog.sh
#! /bin/bash
source ~/profile_orcl
#记录归档删除的日志
exec >> /home/rman_log/log/del_arch`date +%F-%H`.log
$ORACLE_HOME/bin/rman target / <<EOF
#检查归档
crosscheck archivelog all;
#列出无效的归档日志
list expired archivelog all;
#删除无效归档
delete noprompt expired archivelog all;
#删除七天前的归档
delete noprompt archivelog until time 'sysdate-7';
#删除所有的归档
#delete noprompt archivelog all;
exit;
EOF
2、修改clearlog.sh脚本的权限及所有者所属组
chown oracle:oinstall clearlog.sh
chmod 775 clearlog.sh
3、以oracle用户设置定时任务
$crontab -e
* * * * * /home/oracle/clearlog.sh