定时清理归档脚本

Posted lvcha001

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了定时清理归档脚本相关的知识,希望对你有一定的参考价值。

#创建目录:
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

 

以上是关于定时清理归档脚本的主要内容,如果未能解决你的问题,请参考以下文章