脚本宝典收集整理的这篇文章主要介绍了oracle自动清理archivelog文件的具体方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
1.登陆到
服务器上创建rman自动删除两天前的归档日志脚本
[
oracle@108 ~]$ cat >>del_ora_
LOG.rman <<EOF
&nbs
p;crosscheck
Archivelog all;
delete nop
rompt e
xpi
red archivelog all;
delete no
PRompt force archivelog until time '
Sysdate -2'; -------删除两天前的archivelog
ex
IT;
EOF
2.手动执行清除日志
[oracle@108 ~]$ rman t
arget/ cm
DFile=/home/oracle/del_ora_log.rman msglog=/home/oracle/del_ora_log.rman.log
3.将脚本加入系统定时
任务注意:任务执行的时候环境变量不能应用上,导致rman命令不能执行成功,可以将环境变量和命令放到一个脚本中,这样执行就没有问题。
Shell代码
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LI
brARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
rman target/ cmdfile=/home/oracle/del_ora_log.rman msglog=/home/oracle/del_ora_log.rman.log >>/home/oracle/rman.log 2>&
amp;1
[oracle@108 ~]$ crontab -e
13 * * * * /home/oracle/del_ora_log.sh >>del_ora_log.log 2>&1
4.某些表
插入数据频繁但数据又不太
重要可以去掉log。
ALTER TABLE <tablename> NOLOG
ginG;
脚本宝典总结
以上是脚本宝典为你收集整理的oracle自动清理archivelog文件的具体方法全部内容,希望文章能够帮你解决oracle自动清理archivelog文件的具体方法所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。