Linux的定时清理oracle归档日志文件及脚本

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:159

[font=隶书][size=16.0pt]Linux[font=隶书][size=16.0pt]的定时清理oracle归档日志文件及脚本
定时 crontab用root用户编辑corntab 定时任务[table=98%,black]
[td=568] [color=lime][root@gmmsrv02 ~]# crontab -l [color=lime]0 1 * * * su - oracle -c "/home/oracle/rmanbk/rman_del_arch.sh" [color=lime]0 1 * * * echo "hello backup over" > /home/oracle/stadb.txt [color=lime]
注意,原来自己使用了oracle用户下的crontab定时任务,但是没有执行。在root用户下能够执行。该定时任务并能生成rman的日志文件。该文件是清理超过5天的archivelog文件
定时清理 oracle数据库的archivelog文件[table=98%,black]
[td=568] [color=lime]#rman_del_arch.sh [color=lime]#mailto:liul21cn@126.com]liul21cn@126.com [color=lime]#!/bin/sh [color=lime] [color=lime]#. $HOME/.bash_profile [color=lime]. /home/oracle/.bash_profile [color=lime] [color=lime]echo "--------------------------------------------" [color=lime]echo "Begin database Delete Archivelog ......" [color=lime]echo "Begin time:"`date` [color=lime] [color=lime] [color=lime]back_path="/datavg/oracle_area/rman_data_bak"; [color=lime]back_log="/datavg/oracle_area/rman_data_bak/log"; [color=lime]#rman_name="rman" [color=lime]#rman_pw="rman"; [color=lime]#rman_log_name="racdb"; [color=lime]#rman_log_pass="racdb"; [color=lime]#rman_sid="gmmdb"; [color=lime]rman_bin=/opt/app/oracle/product/10.2.0/db_1/bin/rman [color=lime] [color=lime]rman target / nocatalog log=$back_log/del_arch_`date +%Y-%m-%d`.log << !EOF [color=lime]run { [color=lime] allocate channel ch_rac11 device type disk maxpiecesize 2G connect 'sys/oracle@gmmdb' ; [color=lime] delete noprompt archivelog until time 'sysdate-5'; [color=lime] release channel ch_rac11 ; [color=lime]} [color=lime]crosscheck backup; [color=lime]delete noprompt expired backup; [color=lime]delete noprompt obsolete;

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】