1、在listener.ora文件中加入参数TRACE_LEVEL_LISTENER=16,或者在命令行输入lsnrctl trace 16,如:
[oracle@ligle-db ~]$ lsnrctl trace 16
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 17-JAN-2011 17:10:34
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ligle-db)(PORT=1521)))
Opened trace file: /u01/app/oracle/product/10.2.0/db_1/network/trace/listener.trc
The command completed successfully
注:TRACE_LEVEL_LISTENER的取值范围为0~16,当然级别越高,收集的信息就相对越全面,系统默认是0,即不生成trace信息。
2、此时,客户端通过listener连接到服务器的关于监听相关的信息都会记录到trace文件中,trace文件默认是存放在$ORACLE_HOME/network/trace目录下。
3、关闭Listener Trace。可通过将listener.ora文件中的TRACE_LEVEL_LISTENER设置为0,或者直接在命令行执行lsnrctl trace OFF,如:
[oracle@ligle-db ~]$ lsnrctl trace OFF
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 17-JAN-2011 17:20:59
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ligle-db)(PORT=1521)))
The command completed successfully
4、进入$ORACLE_HOME/network/trace目录,格式化trace文件,如:
[oracle@ligle-db trace]$ trcasst listener.trc > abc.log
至于经过trcasst格式化后的trace文件,该怎么看,我现在也是在试着看,有什么心得,再与大家分享,本文主要介绍如何生成listener trace文件,以帮助大家多一种解决关于listener方面的问题。
监听有密码和没有密码的处理:
如果是监听没有密码的情况下:
1.在listener.ora文件中加入参数TRACE_LEVEL_LISTENER=16,或者在命令行输入lsnrctl trace 16(默认监听) 或 lsnrctl trace listener_name 16
[oracle@db ~]$lsnrctl trace listener_name 16
注:TRACE_LEVEL_LISTENER的取值范围为0~16,当然级别越高,收集的信息就相对越全面,系统默认是0,即不生成trace信息。
2.此时,客户端通过listener连接到服务器的关于监听相关的信息都会记录到trace文件中,trace文件默认是存放在$ORACLE_HOME/network/trace目录下。
3.关闭Listener Trace。可通过将listener.ora文件中的TRACE_LEVEL_LISTENER设置为0,或者直接在命令行执行lsnrctl trace OFF
[oracle@db ~]$lsnrctl trace OFF
4.进入$ORACLE_HOME/network/trace目录,格式化trace文件,如:
[oracle@db trace]$trcasst listener.trc > abc.log
如果是监听有密码的情况下:
下面是具体操作:
KSAVPROD:/u07/app/oracle/9.2.0.7/network/trace> lsnrctl
LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production on 29-MAR-2011 10:26:41
Copyright (c) 1991, 2006, Oracle Corporation. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> set current_listener LI_KSAVPROD
Current Listener is LI_KSAVPROD
LSNRCTL> set password 97FE7BB7DC837B9F
The command completed successfully
LSNRCTL>trace 16
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.21.252.4)(PORT=1531)))
Opened trace file: /u07/app/oracle/9.2.0.7/network/trace/li_ksavprod.trc
The command completed successfully
##在可能的故障时间段进行跟踪后(trace文件生成很快,几分钟可能几十M),关闭trace
LSNRCTL> trace off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.21.252.4)(PORT=1531)))
The command completed successfully
##格式化文件
KSAVPROD:/u07/app/oracle/9.2.0.7/network/trace> trcasst li_ksavprod.trc > abc.log
KSAVPROD:/u07/app/oracle/9.2.0.7/network/trace> ls
abc.log li_ksavprod.trc
KSAVPROD:/u07/app/oracle/9.2.0.7/network/trace> more abc.log