Oracle归档日志定时删除任务

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 #启动、停止或重启服务

转载于:https://www.cnblogs.com/saratearing/p/6266208.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值