Wednesday, 1 June 2016


Shell Script to Purge Audit trail


#!/bin/bash
export ORATAB=/etc/oratab
export PATH=/usr/local/bin:/usr/sbin:$PATH
export SQLDIR=/home/oracle/scripts/Maintanence_script
export DATE=`date +%y%m%d`

ps -ef|grep -v grep|grep pmon|awk '{printf(substr($8,10)"\n")}' | while read DBSID
do
ORACLE_SID=$DBSID
export ORACLE_SID=$DBSID
echo Removing older trace file greater than 15 days ${ORACLE_SID}.....
find /app/oracle/admin/${ORACLE_SID}/adump/*.aud -type f -mtime +15 -exec rm -f {} \;
done
exit;

No comments:

Post a Comment