–// Write a common script to clean up aud. And some servers have multiple instances of the situation.

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
Copy the code

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
Copy the code

done

$ORACLE_BASE = /usr/local/bin/purge_oracle_aud.sh

2. Add the crontab page tour script. If there is more intuitive understanding relative to electron, you can also refer to:

www.cungun.com

cat /etc/cron.d/ntp 34 6 * root /usr/local/bin/purge_oracle_aud.sh dbcndg2 >> /var/log/purge_oracle_aud.log 2>&1 –// Every day at 6:34.

3. Modify /etc/logrotate.d/oracle and add the following:

grep -v “^#” /etc/logrotate.d/oracle /var/log/purge_oracle_aud.log {

size=20M rotate 5 copytruncate compress notifempty missingok }