RE: [SOLVED] missing alert.log mystery (it's not what you think)

From: <Joel.Patterson_at_crowley.com>
Date: Tue, 17 May 2011 09:11:44 -0400
Message-ID: <C95D75DD2E01DD4D81124D104D317ACA162106C42B_at_JAXMSG01.crowley.com>



Another way depending on password or not. (password issu outdated, but sometimes auditing... just does auditing), is to change the log file and reload the listener.

Not elegent, but does address the fact that you cannot just rename the listener, (you will run out of disk space and wonder why), and if you have a password... Then just keep X weeks worth of renamed listener log files.

The set log_file command requires ADMIN_RESTRICTIONS_LISTENER=OFF in the listener.ora file -- but we will ignore that (we are 'not setting' the log_file here).

Pseudo steps.

  LISTENER_ORA_DIR=${ORACLE_HOME}/network/admin
  LISTENER_ORA_FILE=${LISTENER_ORA_DIR}/listener.ora
  LISTENER_ORA_BACKUP=${LISTENER_ORA_DIR}/listener_backup.ora
  LISTENER_ORA_TEMPFILE=${LISTENER_ORA_DIR}/listener_temp$$.ora
  LISTENER_LOG_DIR=${ORACLE_HOME}/network/log

  NEW_LISTENER_LOGLINE="LOG_FILE_${LISTENER_NAME}=listener_${DATE}.log"

  # get old logfile name to check for TNS- errors at end of script ( checking not shown here).   OLD_LOGFILE_NAME=`cat ${LISTENER_ORA_FILE} | grep ^LOG_FILE_${LISTENER_NAME} | awk -F= '{print $2}' | awk -F# '{print $1}'`   OLD_LOGFILE_NAME=${LISTENER_LOG_DIR}/${OLD_LOGFILE_NAME}   # Make backup of listener.ora file (check errors in this file)   cp ${LISTENER_ORA_FILE} ${LISTENER_ORA_BACKUP}

  # Change LOG_FILE parameter
  sed s/^LOG_FILE_${LISTENER_NAME}.[^#]*/${NEW_LISTENER_LOGLINE}" "/ ${LISTENER_ORA_FILE} > ${LISTENER_ORA_TEMPFILE}   cp ${LISTENER_ORA_TEMPFILE} ${LISTENER_ORA_FILE}   rm ${LISTENER_ORA_TEMPFILE}

....
....
Reload listener.

  $ORACLE_HOME/bin/lsnrctl <<EOFLSNR
set current_listener ${LISTENER_NAME}
reload
show log_status
show log_file
exit
EOFLSNR Joel Patterson
Database Administrator
904 727-2546



From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Niall Litchfield Sent: Tuesday, May 17, 2011 2:53 AM
To: breitliw_at_centrexcc.com
Cc: ORACLE-L; sacrophyte_at_gmail.com
Subject: Re: [SOLVED] missing alert.log mystery (it's not what you think)

In the case of the listener then lsnrctl can be used to rename the log file On 17 May 2011 01:42, "Wolfgang Breitling" <breitliw_at_centrexcc.com<mailto:breitliw_at_centrexcc.com>> wrote:

I have for years renamed the alert log on a weekly basis, and eventually gzipped it, in order to keep it reasonably sized. Oracle just starts a new alert log. Granted, I haven't done a direct bzip on it but that should be no different - except maybe, if the bzip takes a while and oracle tries to write to it while it is open by bzip. I haven't verified on 11.1.0.7 but on 11.2.0.2 that rename still works and Oracle creates a new alert log with the original name ( alert_instance.log ) so I am pretty confident it does also work for 11.1.0.7. In contrast to. e.g. the listener log, which you must not rename. There I do a cp to a new file followed by cp /dev/null > listener.log.

On 2011-05-16, at 1:50 PM, Charles Schultz wrote:

> On May 6th, the original alert_TEMDEV.log was bzipped and removed by a cron job. Usually we check ...

--
http://www.freelists.org/webpage/oracle-l

--
http://www.freelists.org/webpage/oracle-l
Received on Tue May 17 2011 - 08:11:44 CDT

Original text of this message