Re: truncating listener.log on Windows
Date: Tue, 26 Jul 2011 15:56:11 -0700
Message-ID: <CAHtj8M3MB36o4KhZw5FAJ-SJMs247g+FLw_8yRLTL7fOCbhdDg_at_mail.gmail.com>
Here is simplified version of what I use on Windows 2008 R2
_at_echo off
rem Name lsnrmnt.cmd
rem Purpose: ORACLE LISTENER services maintanance
rem Usage: lsnrmnt.cmd [listener_name
rem
rem Parms:
rem 1 - listener name (default listener)
rem
setlocal enableextensions enabledelayedexpansion
if "%1" == "" (
set LSNR_SID=listener
) else (
set LSNR_SID=%1
)
call e:\oracle\admin\common\sh\oraenv.cmd %LSNR_SID%
set NET_LOG=%OA%\log
for /F "tokens=1-4 delims=/ " %%o in ("%DATE%") do (
set DW=%%o set MM=%%p set DD=%%q set YY=%%r
)
for /F "tokens=1-5 delims=.:" %%s in ("%TIME%") do (
set HH=%%s set MI=%%t set SS=%%u
)
set CURR_DATE=%YY%%MM%%DD%%HH%%MI%%SS%
set CURR_DATE=%CURR_DATE: =0%
(echo set current_listener %LSNR_SID%
echo set log_file %NET_LOG%\%LSNR_SID%.log.2
echo exit
) | %OH%\bin\lsnrctl
rename %NET_LOG%\%LSNR_SID%.log %LSNR_SID%.log.1
(echo set current_listener %LSNR_SID%
echo set log_file %NET_LOG%\%LSNR_SID%.log
echo exit
) | %OH%\bin\lsnrctl
copy %NET_LOG%\%LSNR_SID%.log.1 + %NET_LOG%\%LSNR_SID%.log.2
%NET_LOG%\%LSNR_SID%_%CURR_DAY%.log
del %NET_LOG%\%LSNR_SID%.log.1
del %NET_LOG%\%LSNR_SID%.log.2
endlocal
Alex.
On Tue, Jul 26, 2011 at 1:47 PM, Jay Hostetter <hostetter.jay_at_gmail.com>wrote:
> I use "set log_file", but I don't save the config.
>
> lsnrctl
> >set log_file listener_temp.log
>
> then I rename listener.log to something else (listener_20110725.log)
>
> >set log_file listener.log
>
> If you have admin restrictions on, you'll need to change the listener.ora
> and reload it first.
>
> Jay
>
> On Tue, Jul 26, 2011 at 4:40 PM, Schauss, Peter (ESS) <
> peter.schauss_at_ngc.com> wrote:
>
>> Oracle 10.2.0.3.0 on Windows Server 2003 sp2.
>>
>> How do you truncate the listener log file without bouncing the listener?
>>
>> I know how to do this on UNIX, but when I try "echo > listener.log" I get
>> "cannot access the file because it is being used by another process". The
>> other option, appears to be to use the lsnrctl "set log" command followed by
>> "save config", but, according to MOS, this may crash the listener.
>>
>> Any other options?
>>
>> Thanks,
>> Peter Schauss
>> --
>> http://www.freelists.org/webpage/oracle-l
>>
>>
>>
>
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Jul 26 2011 - 17:56:11 CDT