Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trim alert log which grows over nnGb

user7660937Apr 4 2012 — edited Apr 5 2012
Hi All.

I'm trying to add functionality to our current housekeeping script so that it will trim/truncate (call it what you will) the alert log, log.xml and listener.log files. I have a further issue with ADRCI in that it doesn't purge the cdump_xxx directeries which appear within the trace directory?!?

Database is 11g and as mentioned I am currently using adrci within a shell script.
Firstly the script tests whether the database is less than 11g, if it finds that the database is 11g it will call a function that goes on to execute ADRCI and purges the trace, alert, hm, incident and cdump dirs.

My alert log is very large at the moment mainly because the system is in testing and there have been many instances of flakey application software causing an awful lot of output. ADRCI only deletes the files as specified with the purge -age command.

To recap, I need a script which will check the size of the alert_<db_name>.log file, log.xml file and the listener.log file and if found to be over a certain size, say 500mb for instance then zip the file and touch a new one perhaps?
Secondly I need to also have the script delete the files found within the trace/cdump_xxxx directories

I've written a small script for testing the first part of my request but it doesn't quite perform as expected :

#!/bin/ksh
set -x
/opt/oracle/oracle_base/product/11.2.0/bin/adrci exec="show homes"|grep -v : | while read file_line

do
if [ -f "${ORACLE_BASE}/$file_line/trace/ -name "*.log" -type f -size +1024578c" ];
then
echo ">> $(date +'%d/%m/%Y %H:%M:%S'): found file to be 1gb in size... zipping file"
#gzip {ORACLE_BASE}/$file_line/trace/ -name "*.log"
fi
done

I have #'d out the gzip command in favour of an echo simply for confirmation that i will get the desired effect.
Unfortunately I don't get the expected echo <date> found file to be 1gb in size... zipping file" that i'd hoped for.

Hopefully someone can help.

Thanks in advance.
John
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2012
Added on Apr 4 2012
3 comments
1,397 views