how to recycle lisetner.log file in oracle.
Today i came across rotating listener.log file since its size too big. There are different methods available, however i implemented below method.
Method 1:-
Script:-
cut and past below to a file called rotate_listener.sh file.
###========================Start===========
CURR_TIME=`date +%Y%m%d.%H%M%S`
echo $CURR_TIME
NEW_FILE=”$1_${CURR_TIME}”
echo $NEW_FILE
cp -p $1 $NEW_FILE
if [ -f $NEW_FILE ];
then
# echo “File $NEW_FILE exist.”
echo “” > $1
compress $NEW_FILE
else
# echo “File $NEW_FILE does not exist”
fi
ls -ltr $1_*
###========================END===========
Execution method:-
sh rotate_listener.sh /tmp/listener.log
Method 2:-
Following need to be tested. i just got it from other source but not yet verified.
. /home/grid/db.env
LOGFILE=${2}
DATE_STAMP=`date +%m%d%y%s`
echo $DATE_STAMP
lsnrctl <<END
set current_listener ${1}
set log_status off
exit
END
mv $2 $2.${DATE_STAMP}
ls -ltr $2
lsnrctl <<END
set current_listener ${1}
set log_status on
exit
END
compress $2.${DATE_STAMP}
You must be logged in to post a comment.