Sometimes we need to enable sql*net trace to diagnose sqlplus connection problems such as ora-125*
Below are the steps to configure Sql*Net verbose Client side tracing:
(1) Open the SQLNET.ORA file typically found in the installation location (or simply do a Search):
C:\\>tnsping xx
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 03-12月-2013 11:49:46
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
E:\\oracle\\product\\11.2.0\\client_1\
etwork\\admin\\sqlnet.ora
TNS-03505: 无法解析名称
C:\\> notepad E:\\oracle\\product\\11.2.0\\client_1\
etwork\\admin\\sqlnet.ora
(2) Add the following parameters at the end of the file in pre-11g:
#CLIENT-SIDE SQL*NET TRACE PARAMETERS
#====================================
trace_level_client = 16
trace_file_client = cli
trace_directory_client = c:\\trace
trace_unique_client = on
trace_timestamp_client = on
trace_filelen_client = 100
trace_fileno_client = 2
log_file_client = cli
log_directory_client = c:\\trace\\log
tnsping.trace_directory = c:\\trace\\trace
tnsping.trace_level = admin
Starting from Oracle version 11.1 there are two possible destinations for trace and log files: Automatic Diagnostic Repository (ADR) and non-ADR(old pre 11.1-style).
For ADR-destination we specify:
TRACE_LEVEL_CLIENT=(OFF | USER | ADMIN | SUPPORT)
DIAG_ADR_ENABLED=ON
ADR_BASE=D:\\ORACLE\\LOG
(default for ?nux: ~/oradiag_username/clients/user_username/host*/trace
for windows %systemdrive%\\Documents and Settings\\%username%\\oracle\\oradiag_%username%\\diag\\clients\\user_%username%\\host*\\trace)
TRACE_TIMESTAMP_CLIENT=(ON | true | off | false)
For non-ADR(old style – pre 11.1) destination we specify:
Just Add the following line above the pre-11g content, then sql*net trace files in trace_directory_client directory to generated
DIAG_ADR_ENABLED=OFF
Parameters prefixed with“#” are interpreted as comments and will not affect tracing.
If you want to change the location where the trace file will be saved modify the following two parameters:
(a) TRACE_DIRECTORY_CLIENT
Set this parameter to the folder where you want the trace file to be saved.
WARNING: Do not end the path with a “\\”. This is not necessary and may prevent the trace file from being generated.
(b) trace_level_client
Table 3 - 2. SQLNET.ORA Diagnostic Parameters
Parameters | Default | Values | Example (DOS client, UNIX server) |
TRACE_LEVEL_CLIENT | OFF | [OFF | USER |ADMIN] | TRACE_LEVEL_CLIENT=USER |
TRACE_FILE_CLIENT | SQLNET.TRC | string | TRACE_FILE_CLIENT=CLIENT |
TRACE_DIRECTORY_CLIENT | O/S specific | valid directory | TRACE_DIRECTORY_CLIENT= c:\ ET\\ADMIN |
TRACE_UNIQUE_CLIENT | OFF | [ON|OFF] | TRACE_UNIQUE_CLIENT=ON |
LOG_FILE_CLIENT | SQLNET.LOG | string | LOG_FILE_CLIENT=CLIENT |
LOG_DIRECTORY_CLIENT | O/S specific | valid directory | LOG_DIRECTORY_CLIENT=c:\ ET\\ADMIN |
TRACE_LEVEL_SERVER | OFF | [OFF | USER | ADMIN] | TRACE_LEVEL_SERVER=ADMIN |
TRACE_FILE_SERVER | SQLNET.TRC | string | TRACE_FILE_SERVER=unixsrv_2345.trc |
TRACE_DIRECTORY_SERVER | O/S specific | valid directory | TRACE_DIRECTORY_SERVER=/tmp/trace |
LOG_FILE_SERVER | SQLNET.LOG | string | LOG_FILE_SERVER=unixsrv.log |
LOG_DIRECTORY_SERVER | O/S specific | valid directory | LOG_DIRECTORY_SERVER=/tmp/trace |
Note: You control both log and trace parameters for the client through Oracle Network Manager. You can also control trace parameters for the client through the SQLNET.ORA Editor. You control log and trace parameters for the server by manually adding the desired parameters to the SQLNET.ORA file.
Parameter | Description |
TRACE_DIRECTORY_CLIENT | Specifies the directory for the client trace file |
TRACE_FILE_CLIENT | Specifies the name of the client trace file |
TRACE_DIRECTORY_SERVER | Specifies the directory for the server trace file |
TRACE_FILE_SERVER | Specifies the name of the server trace file |
TRACE_FILELEN_CLIENT | Specifies the size of each client trace file in kilobytes |
TRACE_FILENO_CLIENT | Specifies the number of client trace files |
TRACE_FILELEN_SERVER | Specifies the size of each server trace file in kilobytes |
TRACE_FILENO_SERVER | Specifies the number of server trace files |
TRACE_LEVEL_CLIENT | Specifies the level of detail for client trace |
TRACE_LEVEL_SERVER | Specifies the level of detail for server trace |
TRACE_TIMESTAMP_CLIENT | Includes a timestamp (to microseconds) for each event in the client trace |
TRACE_TIMESTAMP_SERVER | Includes a timestamp (to microseconds) for each event in the client trace |
TRACE_UNIQUE_CLIENT | Creates an individual client trace file for each process |
For both TRACE_LEVEL_CLIENT and TRACE_LEVEL_SERVER, the parameter can take a numeric value between 0 and 16 where 0 is disabled and 16 is the most detailed. Alternatively these parameters can also take a scalar value was follows:
|
more references http://docs.oracle.com/cd/A57673_01/DOC/net/doc/NWTR23/ch3trc.htm#toc025
(3) When you are finished with the SQL*trace, be sure to remove the lines from the sqlnet.ora file.
take a example
C:\\>tnsping icme
C:\\trace\\trace 的目录
2013-12-03 10:04 <DIR> .
2013-12-03 10:04 <DIR> ..
2013-12-03 11:38 6,018 tnsping.trc
CONFIGURATION FILES
Files required to enable Oracle Net tracing and logging features include:
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
References
http://www.juliandyke.com/Diagnostics/Trace/NetTrace.html复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
670次阅读
2025-04-18 14:18:38
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
629次阅读
2025-04-15 17:24:06
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
539次阅读
2025-04-20 10:07:02
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
487次阅读
2025-04-17 17:02:24
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
482次阅读
2025-04-22 00:20:37
一页概览:Oracle GoldenGate
甲骨文云技术
464次阅读
2025-04-30 12:17:56
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
453次阅读
2025-04-22 00:13:51
火焰图--分析复杂SQL执行计划的利器
听见风的声音
410次阅读
2025-04-17 09:30:30
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
371次阅读
2025-04-15 14:48:05
OR+DBLINK的关联SQL优化思路
布衣
349次阅读
2025-05-05 19:28:36
热门文章
移除DataGuard Standby配置导致Primary启动失败
2023-08-17 21341浏览
使用dblink产生的”SELECT /*+ FULL(P) +*/ * FROM XXXXX P ” 解析
2023-06-20 20904浏览
Troubleshooting 'ORA-28041: Authentication protocol internal error' change password 12c R2 DB
2020-04-08 13694浏览
浅谈ORACLE免费数据库Oracle Database XE (Express Edition) 版
2018-10-31 7664浏览
High wait event ‘row cache mutex’ in 12cR2、19c
2020-08-14 5603浏览