TNS-12508: TNS:listener could not resolve the COMMAND given

Setting “ADMIN_RESTRICTIONS_listener_name=on” disables the runtime
modification of parameters in listener.ora.

Got error message “TNS-12508: TNS:listener could not resolve the COMMAND given” when trying to switch off listener log.

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

Subscribe to get access

Read more of this content when you subscribe today.

Recycle Listener Logs Online

It is a good practice to recycle listener logs which grows in size day by day.

The listener logs including SCAN listeners are growing very fast and big. So we need purge them periodically. We can stop listener, rename/delete/zip the listener logs, but it is not a good practice to stop listener at any time, because it will impact the business.

Here is a simple way to purge listener logs online:

$ lsnrctl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 21-SEP-2016 10:17:10
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.

LSNRCTL> set
The following operations are available after set
An asterisk (*) denotes a modifier or extended command:
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 valid_node_checking_registration
registration_invited_nodes registration_excluded_nodes

LSNRCTL> set current_listener listener
Current Listener is listener

LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
listener parameter "log_status" set to ON
The command completed successfully

LSNRCTL> set log_status off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
listener parameter "log_status" set to OFF
The command completed successfully
LSNRCTL> exit


$ cd /u01/app/grid/diag/tnslsnr/racnode1/listener/trace
$ ls -ltr
total 223388
...
..
.
-rw-r----- 1 grid oinstall 146333508 Sep 21 10:17 listener.log
...
..
.
$cp listener.log listener_old.log
$cat /dev/null > listener.log

$ lsnrctl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 21-SEP-2016 10:17:52
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.

LSNRCTL> set current_listener listener
Current Listener is listener
LSNRCTL> show log_status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
listener parameter "log_status" set to OFF
The command completed successfully


LSNRCTL> set log_status on
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
listener parameter "log_status" set to ON
The command completed successfully
LSNRCTL> exit


$ ls -ltr
total 224816
...
..
.
-rw-r----- 1 grid oinstall 146333508 Sep 21 10:17 listener_old.log
-rw-r----- 1 grid oinstall 2834 Sep 21 10:18 listener.log
...
..
.