定时清理归档脚本

#创建目录:
mkdir -p /home/oracle/tools/clear_log/
#编辑shell.sh 脚本
vi /home/oracle/tools/clear_log/clear_arch.sh
#!/bin/sh

. ~/.bash_profile

cd /home/oracle/tools/clear_log
rman target /  log=clear_arch.log < clear_arch.sql
##复制粘贴###
#编辑Shell调用的删除归档脚本:RMAN执行的delete=>sql操作
vi /home/oracle/tools/clear_log/clear_arch.sql
delete noprompt archivelog until time 'sysdate-1';

#编辑定时任务
[oracle@bdp04 ~]$ crontab  -e
no crontab for oracle - using an empty one
#delete archive log --delete one day date archive log
00 * * * * sh /home/oracle/tools/clear_log/clear_arch.sh 1>/tmp/clear_arch.log 2>&1

猜你喜欢

转载自www.cnblogs.com/lvcha001/p/11764905.html
今日推荐