暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

监听设置trace的方法

原创 黄宸宁 2013-06-24
1152
有时候监听出现问题的时候,除了查看正常的监听日志文件外,还可以通过为监听设置trace的方法进行分析。
方法一:直接通过命令在lsnrctl下设置

[oracle@secdb1 admin]$ 
[oracle@secdb1 admin]$
[oracle@secdb1 admin]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-JUN-2013 13:07:39
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type help for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 24-JUN-2013 12:48:49
Uptime 0 days 0 hr. 18 min. 52 sec
Trace Level off
Security ON Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service PROD has 1 instance(s).
Instance PROD, status UNKNOWN, has 1 handler(s) for this service...
Service plsextproc has 1 instance(s).
Instance UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL>
LSNRCTL>
LSNRCTL> show
The following operations are available after show
An asterisk (*) denotes a modifier or extended command:
rawmode displaymode
rules trc_file
trc_directory trc_level
log_file log_directory
log_status current_listener
inbound_connect_timeout startup_waittime
snmp_visible save_config_on_stop
LSNRCTL>
LSNRCTL> show trc_level
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
LISTENER parameter trc_level set to off ----还未设置trace
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL> trace admin listener ----打开trace
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
Opened trace file: /u01/app/oracle/product/10.2.0/db_1/network/trace/listener.trc ---trace文件
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL>
LSNRCTL>
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 24-JUN-2013 12:48:49
Uptime 0 days 0 hr. 20 min. 27 sec
Trace Level admin
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listener Trace File /u01/app/oracle/product/10.2.0/db_1/network/trace/listener.trc ----多出了trace文件一行
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service PROD has 1 instance(s).
Instance UNKNOWN, has 1 handler(s) for this service...
Service plsextproc has 1 instance(s).
Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
LSNRCTL>
LSNRCTL> show trc_level
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
LISTENER parameter set to admin
The command completed successfull
LSNRCTL>
LSNRCTL>
LSNRCTL>
LSNRCTL> trace off  ----关闭trace
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
The command completed successfully
LSNRCTL>
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 24-JUN-2013 12:48:49
Uptime 0 days 0 hr. 23 min. 31 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb1.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "PROD" has 1 instance(s).
Instance "UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
Instance "UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>


trace内容:

[oracle@secdb1 ~]$ 
[oracle@secdb1 ~]$ cat /u01/app/oracle/product/10.2.0/db_1/network/trace/listener.trc
nsglrespond: entry
nsdo: cid=5, opcode=67, *bl=123, *what=1, uflgs=0x0, cflgs=0x3
nsdo: rank=64, nsctxrnk=0
nsdo: nsctx: state=8, flg=0x100400c, mvd=0
nsdo: gtn=208, gtc=208, ptn=10, ptc=2011
nsdo: 123 bytes to NS buffer
nsdo: nsctxrnk=0
nsglrespond: exit
nsgldissolve: entry
nstimarmed: no timer allocated
nsdo: cid=5, opcode=66, *bl=0, *what=0, uflgs=0x0, cflgs=0x2
nsdo: rank=64, nsctxrnk=0
nsdo: nsctx: state=8, flg=0x1004008, mvd=0
nsevunreg: cid=5, sgt=0, rdm=0
nsevunreg: 3 registered connection(s)
nsdo: cid=5, opcode=67, *bl=0, *what=1, uflgs=0x0, cflgs=0x1
nsdo: nsctx: state=8, flg=0x1004008, mvd=0
nsdo: gtn=208, gtc=208, ptn=133, ptc=2011
nsdofls: DATA flags: 0x40
nsdofls: sending NSPTDA packet
nspsend: plen=133, type=6
ntuswrte: entry
ntuswrte: Wrote on 12 bytes 133
ntuswrte: exit
nspsend: 133 bytes to transport
nsdo: nsctxrnk=0
nsclose: closing transport
ntusdisc: entry
ntusdisc: Closed socket 12
ntusdisc: exit
nsclose: global context check-out (from slot 5) complete
nsmfr: 1580 bytes at 0x8f2a578
nsmfr: 752 bytes at 0x8efdfb0
nsgldissolve: Deallocating cxd 0x8f00118.
nsgldissolve: exit
nsevwait: 3 registered connection(s)
nsevwait: 0 pre-posted event(s)
nsevwait: waiting for transport event (1 thru 4)...
nsevwait: 1 newly-posted event(s)
nsevfnt: cxd: 0x8eeb938 stage 0: NT events set:
CONNECTION REQUEST
nsevfnt: cxd: 0x8eeb938 stage 0: NS events set:
INCOMING CALL
nsevwait: event is 0x1, on 1
nsevwait: 1 posted event(s)


方法二:在listener.ora中设置
通过配置下面4个参数:
TRACE_LEVEL_LISTENER_NAME:指定TRACE级别(0/4/6/16)
TRACE_FILE_LISTENER_NAME:指定trace文件名称
TRACE_DIRECTORY_LISTENER_NAME:指定tracen文件目录
TRACE_TIMESTAMP_LISTENER_NAME:指定trace文件中是否添加时间戳(on/off)
其中:
LISTENER_NAME为需要做trace的监听名
LISTENER_LEVEL:
Specify one of the following trace levels:

  • off(等价于0) for no trace output

  • user(等价于4) for user trace information

  • admin(等价于6) for administration trace information

  • support(等价于12) for Oracle Support Services trace information

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论