Temporary stop listener to log with ‘set log_status’

When moving/deleting the listener.log, I used to stop and start the listener and move/delete the listener in between the actions.
This method has a big inconvenience: users can not connect to the database for a few seconds…
What I never knew was that the listener could be told to stop and start logging and take the appropriate action in between.

A colleague (Joords) reminded me of the following listener option:

lsnrctl set log_status [on|off]

On Windows

cd \oracle\product\10.2.0\db_1\NETWORK\log
lsnrctl set log_status off
rename listener.log listener.old
lsnrctl set log_status on

On UNIX

cd /u01/app/oracle/product/10.2.0/db_1/NETWORK/log
lsnrctl set log_status off
mv listener.log listener.old
lsnrctl set log_status on

Admin restrictions

One of the comments I got from Guillaume mentions that when ADMIN_RESTRICTIONS are turned on, the command is not available any more…

Tagged , , , , . Bookmark the permalink.

6 Responses to Temporary stop listener to log with ‘set log_status’

  1. Gabriel Menini says:

    Not working here:

    % $ORACLE_HOME/bin/lsnrctl set log_status on

    LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.4.0 – Production on 23-JUN-2010 13:29:49

    Copyright (c) 1991, 2007, Oracle. All rights reserved.

    Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=SM1.WORLD))
    TNS-12508: TNS:listener could not resolve the COMMAND given

    % $ORACLE_HOME/bin/lsnrctl show log_status

    LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.4.0 – Production on 23-JUN-2010 13:30:13

    Copyright (c) 1991, 2007, Oracle. All rights reserved.

    Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=SM1.WORLD))
    LISTENER parameter “log_status” set to ON
    The command completed successfully

  2. Ian Hoogeboom says:

    Hi Gabriel,

    Does the set command work when you run it from the lnsrctl command prompt?

    % $ORACLE_HOME/bin/lsnrctl
    LSNRCTL> set log_status off
    LSNRCTL> set log_status on

    Regards,
    Ian.

  3. baikelin says:

    not working here either

    LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.2.0 – Production on 19-JUL-2012 12:10:31

    Copyright (c) 1991, 2010, Oracle. All rights reserved.

    Welcome to LSNRCTL, type “help” for information.

    LSNRCTL> set log_status off
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=pcyaz0hmfv46)(PORT=1521)))
    TNS-12508: TNS:listener could not resolve the COMMAND given

    • Ian Hoogeboom says:

      If you type ‘>lsnrctl set’, is the ‘log_status’ command available? If not, it maybe is not implemented on IBM/AIX RISC System/6000 or can not be used on the command line.

      The following operations are available after set
      An asterisk (*) denotes a modifier or extended command:

      password
      rawmode
      displaymode
      trc_file
      trc_directory
      trc_level
      log_file
      log_directory
      log_status
      current_listener
      inbound_connect_timeout
      startup_waittime
      save_config_on_stop
      dynamic_registration
      enable_global_dynamic_endpoint
      connection_rate_limit

  4. Guillaume says:

    I just came to this page, because of the same issue as baikelin.
    I found that when you secure your listener with ADMIN_RESTRICTIONS_ = ON, you cannot issue any set command anymore, even the “tinny” “set log_status off”, and get the TNS-12508 error.
    Check your listener.ora configuration

    • Ian Hoogeboom says:

      Hi Guillaume,
      So it’s Oracle which hides some commands when the ADMIN_RESTRICTIONS is set. Interesting. To bad an error is raised that the command can not be found, instead of a message that there are admin restrictions…
      Thanks for finding this!
      Cheers, Ian.

Leave a Reply

Your email address will not be published. Required fields are marked *