【TRACE】如何设置或动态跟踪Oracle net侦听器

来源:这里教程网 时间:2026-03-03 17:28:46 作者:

APPLIES TO:

Oracle Net Services - Version 11.2.0.1 to 19.5.0.0.0 [Release 11.2 to 19] Oracle Database - Enterprise Edition - Version 12.2.0.1 to 12.2.0.1 [Release 12.2] Information in this document applies to any platform.

GOAL

 This document is intended to clarify that from 11.2 onwards, there is no need to first set any tracing parameters under listener.ora or reload the listener to activate listener tracing with timestamps. Listener tracing can be enabled dynamically through 'set trc_level' command in lsnrctl utility. Independent if ADR is or not enabled, the trace is created with timestamps. Limitation ~~~~~~~~ Please note that if the  ADMIN_RESTRICTIONS_<listener_name> is set to ON for the Listener, then this cannot be done. This parameter needs to be set to OFF or commented out for Dynamic commands to work.

 

SOLUTION

If your listener name is not using the default name of "listener", then run the command " set current_listener <listener name>"  in lsnrctl utility , before any other command is used.

LSNRCTL>  set current_listener LISTENER_TEST Current Listener is LISTENER_TEST

  1. To enable SQL*Net listener tracing dynamically run 'set trc_level 16' command in lsnrctl utility:

 

LSNRCTL>  set trc_level 16 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) LISTENER_TEST parameter "trc_level" set to support The command completed successfully

 

The trace generated has timestamps recorded. There is no need for any other previous tracing parameters to be added under listener.ora file.

 If ADR is enabled for the listener , the trace is generated under $ORACLE_BASE/diag/tnslsnr/<hostname>/listener/trace on UNIX or $ORACLE_BASE\diag\tnslsnr\<hostname>\listener\trace on Windows. Default trace name is ora_xxxx_xxxxxxxxx.trc

LSNRCTL>  show trc_file Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) LISTENER_TEST parameter "trc_file" set to ora_17351_47472935529200.trc The command completed successfully

  If ADR is disabled for the listener , the trace is generated under $ORACLE_HOME/network/trace on UNIX or $ORACLE_HOME\network\trace on Windows. Default trace name is <listener_name>.trc

LSNRCTL>  show trc_file Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) LISTENER_TEST parameter "trc_file" set to listener_test.trc The command completed successfully

 

2. To disable SQL*Net listener tracing dynamically run 'set trc_level 0' command in lsnrctl utility:

 

LSNRCTL>  set trc_level 0 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) LISTENER_TEST parameter "trc_level" set to off The command completed successfully

 

Limitation As mentioned above, if you have the  ADMIN_RESTRICTIONS_<listener_name> set to ON for the Listener in the listener.ora file, then you cannot issue any dynamic commands against this listener. For example: ADMIN_RESTRICTIONS_<listenername> = ON The error that will be thrown is:

LSNRCTL> set trc_level 16 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) TNS-12508: TNS:listener could not resolve the COMMAND given

  This parameter would need to be set to OFF or commented out, for Dynamic commands to work: ADMIN_RESTRICTIONS_<listenername> = OFF Now this will work:

LSNRCTL> set trc_level 16 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<hostname.domain>)(PORT=1529))) LISTENER parameter "trc_level" set to support The command completed successfully

 

相关推荐