首页 > 数据库技术 > 详细

Oracle归档日志定时删除任务

时间:2017-01-09 20:23:09      阅读:463      评论:0      收藏:0      [点我收藏+]

1、在Oracle账号下,创建归档日志删除文件del_arch.sh

文件位置:/home/oracle/crontabOra,内容如下:

#!/bin/bash
LOG_DIR=/home/oracle/crontabOra/log/
DATEL=`date +%Y-%m-%d`
LOG_NAME=${LOG_DIR}${DATEL}".log"

$ORACLE_HOME/bin/rman log=$LOG_NAME target sys/123456@greedb <<EOF
crosscheck archivelog all;
delete force noprompt archivelog all completed before sysdate-6;
exit;
EOF

2、赋可执行权限

chmod +x del_arch.sh

3、设定定时任务,在Oracle账号下,编辑配置文件

crontab -e

配置文件内容(每天下午5点执行删除任务):
0 17 * * * /home/oracle/crontabOra/del_arch.sh

ps -ef | grep crond #判断定时服务是否启动

service crond start|stop|restart #启动、停止或重启服务

Oracle归档日志定时删除任务

原文:http://www.cnblogs.com/saratearing/p/6266208.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!