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

相关文章:

  • 2021-08-07
  • 2021-09-11
  • 2022-01-05
  • 2022-02-05
  • 2021-12-21
  • 2022-12-23
  • 2021-06-24
猜你喜欢
  • 2022-12-23
  • 2022-01-28
  • 2021-06-03
  • 2021-06-16
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案