Archive

Archive for the ‘10g’ Category

how to recycle lisetner.log file in oracle.

February 12, 2016 Comments off

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}

 

 

 

Categories: 10g, 11g