Oracle Articles, Oracle Tools, Oracle Tips, Database Articles and DBA Tips  

The Largest Online Resource for Oracle Articles, Oracle Tips, Oracle Scripts & Oracle Tools!!


Enter your Email:
 
Navigate at FreeMegaZone Home      Articles      Tools      Jobs      Games      Support      Submit Content      Advertise
Advertise at http://www.articles.freemegazone.com

Advertise at FreeMegaZone

Give tremendous boost to your business by advertising at FreeMegaZone. Contact webmaster@freemegazone.com

 


Rating: *****                                             Rate this article:    

Author: Simon Bakker

We face a number of short-term yet frustrating issues when our listener log files grow beyond a certain size. It is advised to recycle Oracle log file when the size limit reaches 30MB but this can vary based on your application. In this article we will discuss some amazing tips to handle the growth of your listener log files. Article Continues below...

When the listner log file grows beyond size then most database administrators recycle the listener.log file by removing or renaming the log file. One option to recycle your listener.log file is to first stop the listener, then renaming the listener log file to the name of the backup file and then starting the listener.

You must have experienced that when you attempt to clear the listener.log file then Windows holds a lock on the file. For this purpose they have to stop and then start the TNS listener process. Below command can be used to rename or remove the listener log file without the need to stop and then start the TNS listener process under either Windows. You will have to run these commands from your %ORACLE_HOME%\network\admin directory.

LSNRCTL SET LOG_STATUS OFF
RENAME LISTENER.LOG LISTNER.OLD
LSNRCTL SET LOG_STATUS ON

You can use below korn shell script (ksh) to check for the listener.log file size. You can put the script on the crontab and then need not to worry about it. Basically this script works by determining the size of your listerner log file. If it has reached a specific size then it renames the listener log file to a file with .bak extension and then creates a new listener.log file. cat /dev/null > listener.log command can be used to truncate the listener.log without stopping the listener. However this command will not erase the logfile and make it empty only and the flow of information will not be interrupted because it maintains the same inode value.

#!/USR/BIN/KSH

ENV_FILE=${1}

IF [ ! -F ${ENV_FILE} ]
THEN
/USR/BIN/ECHO “SORRY THE ${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 Read Again!!

 More Oracle Articles, Database Articles and DBA Tips
   Database Security: Step by step guideline
   Windows Tasklist Command - An Equivalent Of Unix’s Ps Command
   Common Database design mistakes – Do you avoid them?
   Inside Oracle Temporary Tables!!
   Improved Statistics Gathering in Oracle 11g


 

 
HOME      ABOUT US      SUPPORT      SITE MAP      PRIVACY POLICY      TERMS OF USE      SUBMIT CONTENT      ADVERTISE
Copyright © 2007 - 2012 Oriole Intellect Inc. All rights reserved.

The name Oracle is a trademark of Oracle Corporation. Any other names used on this website may be trademarks of their respective owners