一、Oracle trace的相关参数
TRACE_LEVEL_[CLIENT SERVER LISTENER] = [0-16 USER ADMIN SUPPORT OFF]
TRACE_FILE_[CLIENT SERVER LISTENER] = <FILE NAME>
TRACE_DIRECTORY_[CLIENT SERVER LISTENER] = <DIRECTORY>
TRACE_UNIQUE_[CLIENT SERVER LISTENER] = [ON TRUE OFF FALSE]
TRACE_TIMESTAMP_[CLIENT SERVER LISTENER] = [ON TRUE OFF FALSE] #Oracle8i+
TRACE_FILELEN_[CLIENT SERVER LISTENER] = <SIZE in KB> #Oracle8i+
TRACE_FILENO_[CLIENT SERVER LISTENER] = <NUMBER> #Oracle8i+
LOG_FILE_[CLIENT SERVER LISTENER] = <FILE NAME>
LOG_DIRECTORY_[CLIENT SERVER LISTENER] = <DIRECTORY NAME>
LOGGING_LISTENER = [ON OFF]
TNSPING.TRACE_LEVEL = [0-16 USER ADMIN SUPPORT OFF]
TNSPING.TRACE_DIRECTORY = <DIRECTORY>
NAMES.TRACE_LEVEL = [0-16 USER ADMIN SUPPORT OFF]
NAMES.TRACE_FILE = <FILE NAME>
NAMES.TRACE_DIRECTORY = <DIRECTORY>
NAMES.TRACE_UNIQUE = [ON OFF]
NAMES.LOG_FILE = <FILE NAME>
NAMES.LOG_DIRECTORY = <DIRECTORY>
NAMES.LOG_UNIQUE = [ON OFF]
NAMESCTL.TRACE_LEVEL = [0-16 USER ADMIN SUPPORT OFF]
NAMESCTL.TRACE_FILE = <FILE NAME>
NAMESCTL.TRACE_DIRECTORY = <DIRECTORY>
NAMESCTL.TRACE_UNIQUE = [ON OFF]NOTES ON TRACING 11g AND NEWER CLIENT/SERVER/LISTENER/CMAN
对于Oracle 11g,使用传统的Oracle net tracing时,必须添加下列参数
Sqlnet.ora file on either client or server:
DIAG_ADR_ENABLED=OFF
Listener.ora file:
DIAG_ADR_ENABLED_<listener_name>=OFF
CMAN.ORA:
DIAG_ADR_ENABLED=OFF
ADR_BASE=c:\your_directory
二、oracle net trace的组件,参数文件及缺省的trace文件
Oracle Net Component Configuration File Default Trace File
----------------------- --------------------- --------------------------------
Oracle Net Listener LISTENER.ORA LISTENER.TRC
Oracle Net - Client SQLNET.ORA on client CLI*.TRC
Oracle Net - Server SQLNET.ORA on server SVR_*.TRC
TNSPING SQLNET.ORA on client server TNSPING.TRC
Oracle Name Server NAMES.ORA NAMES.TRC
Oracle NAMESCTL SQLNET.ORA on server
Oracle Connection Manager CMAN.ORA
三、TRACE时的注意事项
1、确保所需trace组建的配置文件存在
缺省情况下,Oracle会从下列位置搜索网络配置文件
a.TNS_ADMIN environment variable (incl. Windows Registry Key)
b./etc or /var/opt/oracle (Unix)
c.$ORACLE_HOME/network/admin (Unix)
d.%ORACLE_HOME%/Network/Admin or %ORACLE_HOME%/Net80/Admin (Windows)
Note: User-specific Oracle Net parameters may also reside in $HOME/sqlnet.ora file.
An Oracle Net server installation is also a client itself.
2、 确保trace文件所在的磁盘有足够的空间
3、当有关Oracle net故障解决后应立即禁用Oracle net trace特性
4、大型的跟踪日志文件使得进程开销过大,因此在无异常的情况下关闭trace特性,截断日志文件等以提高Oracle net整体性能
5、确保连接的用户对跟踪日志文件所在的路径用户有写权限
6、对于服务器端的trace,将其置为OFF后,并不能立即停止服务器端的trace,需要重启监听
7、Oracle Net本身也产生相关的日志,如监听日志,sqlnet日志等,Oracle Net trace则是在此基础之上提供更为详尽的故障诊断信息
--转自