乐趣区

关于css:如何能够清除aud脚本

–// 发现自己写的革除 aud 脚本通用性不好, 每次都要批改, 写一个通用脚本. 而且一些服务器有多个实例的状况.
–// 编写脚本如下:

cat /usr/local/bin/purge_oracle_aud.sh

! /bin/bash

purge oracle audit log

odebug=${ODEBUG:-0}

if (($# < 1))
then

    echo "arguments is insufficiency , argumentN = oracle_sid N>=1"
    exit  1

fi

for i in “$@”
do

    if [-d /u01/app/oracle/admin/${i}/adump/ ]
    then
            echo
            echo "start purge oracle audit ${i} at :" $(/bin/date +'%Y/%m/%d %T')
            /usr/bin/find /u01/app/oracle/admin/${i}/adump/ -mtime +30  -name "${i}_ora_*.aud" -print -delete
            echo "end   purge oracle auditwww.cungun.com ${i} at :" $(/bin/date +'%Y/%m/%d %T')
            echo
    else
            echo "/u01/app/oracle/admin/${i}/adump/ directory is not exist"
            exit 2
    fi

done

chmod 700 /usr/local/bin/purge_oracle_aud.sh

–// 还是通用性不好, 没有利用环境变量 $ORACLE_BASE, 先临时这样没工夫.

2. 退出 crontab 页游脚本:

cat /etc/cron.d/ntp

34 6 * root /usr/local/bin/purge_oracle_aud.sh dbcndg2 >> /var/log/purge_oracle_aud.log 2>&1
–// 每天 6:34 分执行.

3. 批改 /etc/logrotate.d/oracle, 退出如下:

grep -v “^#” /etc/logrotate.d/oracle

/var/log/purge_oracle_aud.log
{

size=20M
rotate 5
copytruncate
compress
notifempty
missingok

}

退出移动版