ITPub博客

首页 > 数据库 > Oracle > 【TRACE】如何设置或动态跟踪Oracle net侦听器

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

Oracle 作者:xysoul_云龙 时间:2022-02-18 09:08:47 0 删除 编辑

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

 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29487349/viewspace-2856260/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
主要从事Oracle数据库 DBA相关工作,其他操作系统、中间件等也有涉及,热衷分享。岁月老将至,如有幸在江湖中留点踪迹,也是欣慰。 【文盲筱烨】好读书爱运动的IT技术爱好者 微博:文盲筱烨 微信公众号:筱烨视点

注册时间:2014-02-15

  • 博文量
    412
  • 访问量
    1104549