Systems Engineering and RDBMS

Recycling large listener log files

Posted by decipherinfosys on June 16, 2007

When the listener.log file grows beyond a certain size, you can start noticing interim performance and connectivity issues. Oracle support had mentioned to re-cycle the log file when the size reaches 30MB but this can very well vary per application. You can search metalink for this topic and you will find a couple of notes on this topic. In this post, we are posting a korn shell script (ksh) which can be scheduled using crontab to check for the listener.log file size. Script renames the file to a file with .bak extension and creates a new listener.log file when it reaches the max_size parameter mentioned in the script.

#!/usr/bin/ksh

env_file=${1}

if [ ! -f ${env_file} ]
then
/usr/bin/echo “${env_file} file does not exist.”
exit 2
fi

. ${env_file}

max_size=30000000
file=listener.log
file_path=$ORACLE_HOME/network/log/

size=`ls -l $file_path/$file | awk ‘{ print $5;}’`

if [ $size -gt $max_size ]
then
cp $file_path/$file $file_path/$file.bak
cat /dev/null > $file_path/$file
fi

Sorry, the comment form is closed at this time.

 
%d bloggers like this: