sqlnet跟蹤
用客戶端跟蹤資料庫連線問題
sqlnet.ora是oracle客戶端(例如sqlplus、PL/SQL、tnsping命令)使用的引數檔案,控制客戶端訪問資料庫伺服器
開啟sqlnet 跟蹤
下面的內容,參考自:http://blog.csdn.net/ch7543658/article/details/38865645
在client 端有時候能ping的同server端、tnsping也能通,但是使用sqlplus卻連不上server。這時候就可以嘗試一下透過sqlnet來跟蹤一下。
TRACE_LEVEL_CLIENT=16
TRACE_DIRECTORY_CLIENT=/u01/app/oracle/product/11.2.0/db_1/network/admin
TRACE_FILE_CLIENT=client
TRACE_UNIQUE_CLIENT=ON
TRACE_TIMESTAMP_CLIENT=ON
[laolv@centhost3 admin]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) ###NAMES.DIRECTORY_PATH指定CLIENT NAME解析方法的次序,預設是NAMES.DIRECTORY_PATH=(tnsnames, onames, hostname),常使用NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)。 遇到TNSNAMES時:就去tnsnames.orc檔案中查詢資料庫服務別名記錄,將資料庫服務別名解析為對應的資料庫服務。
TRACE_LEVEL_CLIENT=16
TRACE_TIMESTAMP_CLIENT=ON
race file /opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace/ora_32363_140204926600640.trc
2016-12-04 21:42:21.871784 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 21:42:21.946500 : nlstddt_do_alter_trace:New trace stream is /opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace/ora_32363_140204926600640.trc
2016-12-04 21:42:21.946548 : nlstddt_do_alter_trace:New trace level is 16
2016-12-04 21:42:21.946569 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION ENDS ---
2016-12-04 21:42:21.946591 : nlstdtp_trace_pfile:--- PARAMETER SOURCE INFORMATION FOLLOWS ---
2016-12-04 21:42:21.946710 : nlstdts_trace_source:Attempted load of system pfile source /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
2016-12-04 21:42:21.946778 : nlstdts_trace_source:Parameter source loaded successfully
2016-12-04 21:42:21.946913 : nlstdts_trace_source:
2016-12-04 21:42:21.946937 : nlstdts_trace_source:Attempted load of local pfile source /home/laolv/.sqlnet.ora
2016-12-04 21:42:21.946961 : nlstdts_trace_source:Parameter source was not loaded
2016-12-04 21:42:21.946975 : nlstdts_trace_source:
2016-12-04 21:42:21.946992 : nlstdtp_trace_pfile: -> PARAMETER TABLE LOAD RESULTS FOLLOW <-
2016-12-04 21:42:21.947009 : nlstdtp_trace_pfile:Successful parameter table load
2016-12-04 21:42:21.947025 : nlstddp_dump_ptable: -> PARAMETER TABLE HAS THE FOLLOWING CONTENTS <-
2016-12-04 21:42:21.947046 : nlstddp_dump_ptable: TRACE_LEVEL_CLIENT = 16
2016-12-04 21:42:21.947062 : nlstddp_dump_ptable: NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)
2016-12-04 21:42:21.947077 : nlstddp_dump_ptable: TRACE_TIMESTAMP_CLIENT = ON
2016-12-04 21:42:21.947092 : nlstdtp_trace_pfile:--- PARAMETER SOURCE INFORMATION ENDS ---
2016-12-04 21:42:21.947110 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 21:42:21.947163 : nlstddl_do_alter_log:Log stream will be "/opt/oracle/diag/clients/user_laolv/host_2849077872_82/alert/log.xml"
2016-12-04 21:42:21.947182 : nlstddl_do_alter_log:Log stream validation not requested
2016-12-04 21:42:21.947198 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION ENDS ---
2016-12-04 21:42:21.947221 : nlstdipi:entry
2016-12-04 21:42:21.947349 : nlstdipi:exit
2016-12-04 21:42:21.947375 : nigini:entry
2016-12-04 21:42:21.947395 : nigini:Count in the NL global area is now 1
2016-12-04 21:42:21.947407 : nigini:Count in NI gbl area now: 1
2016-12-04 21:42:21.947420 : nrigbi:entry
2016-12-04 21:42:21.947434 : nrigbni:entry
2016-12-04 21:42:21.957870 : nrigbni:Unable to get data from navigation file tnsnav.ora
……
注意:其實上面個問題關於sqlnet trace檔案路徑的問題,我在sqlnet.ora中設定了產生的trace檔案應該在/u01/app/Oracle/product/11.2.0/db_1/network/admin中但是在這個路徑下卻找不到。如果你也遇到了這樣的情況可以到一下路徑找找試一試:$ORACLE_BASE/diag/clients/user_oracle/host_$NUMBER/trace
[laolv@centhost3 trace]$ pwd
/opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace
一個有用的參考:
sqlnet.ora是oracle客戶端(例如sqlplus、PL/SQL、tnsping命令)使用的引數檔案,控制客戶端訪問資料庫伺服器
點選(此處)摺疊或開啟
-
[laolv@centhost3 admin]$ tnsping orclrman
-
-
TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 04-DEC-2016 21:59:47
-
-
Copyright (c) 1997, 2014, Oracle. All rights reserved.
-
-
Used parameter files:
-
/opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
-
-
-
Used TNSNAMES adapter to resolve the alias
-
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.147)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orclrman)))
- OK (10 msec)
開啟sqlnet 跟蹤
下面的內容,參考自:http://blog.csdn.net/ch7543658/article/details/38865645
在client 端有時候能ping的同server端、tnsping也能通,但是使用sqlplus卻連不上server。這時候就可以嘗試一下透過sqlnet來跟蹤一下。
- 1、在client 端編輯sqlnet.ora檔案開啟 sqlnet跟蹤
TRACE_LEVEL_CLIENT=16
TRACE_DIRECTORY_CLIENT=/u01/app/oracle/product/11.2.0/db_1/network/admin
TRACE_FILE_CLIENT=client
TRACE_UNIQUE_CLIENT=ON
TRACE_TIMESTAMP_CLIENT=ON
[laolv@centhost3 admin]$ cat sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) ###NAMES.DIRECTORY_PATH指定CLIENT NAME解析方法的次序,預設是NAMES.DIRECTORY_PATH=(tnsnames, onames, hostname),常使用NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)。 遇到TNSNAMES時:就去tnsnames.orc檔案中查詢資料庫服務別名記錄,將資料庫服務別名解析為對應的資料庫服務。
TRACE_LEVEL_CLIENT=16
TRACE_TIMESTAMP_CLIENT=ON
- 2、使用sqlplus登陸database,會產生sqlnet跟蹤資訊。如下
race file /opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace/ora_32363_140204926600640.trc
2016-12-04 21:42:21.871784 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 21:42:21.946500 : nlstddt_do_alter_trace:New trace stream is /opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace/ora_32363_140204926600640.trc
2016-12-04 21:42:21.946548 : nlstddt_do_alter_trace:New trace level is 16
2016-12-04 21:42:21.946569 : nlstddt_do_alter_trace:--- TRACE CONFIGURATION INFORMATION ENDS ---
2016-12-04 21:42:21.946591 : nlstdtp_trace_pfile:--- PARAMETER SOURCE INFORMATION FOLLOWS ---
2016-12-04 21:42:21.946710 : nlstdts_trace_source:Attempted load of system pfile source /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
2016-12-04 21:42:21.946778 : nlstdts_trace_source:Parameter source loaded successfully
2016-12-04 21:42:21.946913 : nlstdts_trace_source:
2016-12-04 21:42:21.946937 : nlstdts_trace_source:Attempted load of local pfile source /home/laolv/.sqlnet.ora
2016-12-04 21:42:21.946961 : nlstdts_trace_source:Parameter source was not loaded
2016-12-04 21:42:21.946975 : nlstdts_trace_source:
2016-12-04 21:42:21.946992 : nlstdtp_trace_pfile: -> PARAMETER TABLE LOAD RESULTS FOLLOW <-
2016-12-04 21:42:21.947009 : nlstdtp_trace_pfile:Successful parameter table load
2016-12-04 21:42:21.947025 : nlstddp_dump_ptable: -> PARAMETER TABLE HAS THE FOLLOWING CONTENTS <-
2016-12-04 21:42:21.947046 : nlstddp_dump_ptable: TRACE_LEVEL_CLIENT = 16
2016-12-04 21:42:21.947062 : nlstddp_dump_ptable: NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)
2016-12-04 21:42:21.947077 : nlstddp_dump_ptable: TRACE_TIMESTAMP_CLIENT = ON
2016-12-04 21:42:21.947092 : nlstdtp_trace_pfile:--- PARAMETER SOURCE INFORMATION ENDS ---
2016-12-04 21:42:21.947110 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION FOLLOWS ---
2016-12-04 21:42:21.947163 : nlstddl_do_alter_log:Log stream will be "/opt/oracle/diag/clients/user_laolv/host_2849077872_82/alert/log.xml"
2016-12-04 21:42:21.947182 : nlstddl_do_alter_log:Log stream validation not requested
2016-12-04 21:42:21.947198 : nlstddl_do_alter_log:--- LOG CONFIGURATION INFORMATION ENDS ---
2016-12-04 21:42:21.947221 : nlstdipi:entry
2016-12-04 21:42:21.947349 : nlstdipi:exit
2016-12-04 21:42:21.947375 : nigini:entry
2016-12-04 21:42:21.947395 : nigini:Count in the NL global area is now 1
2016-12-04 21:42:21.947407 : nigini:Count in NI gbl area now: 1
2016-12-04 21:42:21.947420 : nrigbi:entry
2016-12-04 21:42:21.947434 : nrigbni:entry
2016-12-04 21:42:21.957870 : nrigbni:Unable to get data from navigation file tnsnav.ora
……
注意:其實上面個問題關於sqlnet trace檔案路徑的問題,我在sqlnet.ora中設定了產生的trace檔案應該在/u01/app/Oracle/product/11.2.0/db_1/network/admin中但是在這個路徑下卻找不到。如果你也遇到了這樣的情況可以到一下路徑找找試一試:$ORACLE_BASE/diag/clients/user_oracle/host_$NUMBER/trace
[laolv@centhost3 trace]$ pwd
/opt/oracle/diag/clients/user_laolv/host_2849077872_82/trace
一個有用的參考:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25097694/viewspace-2129693/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQLNET跟蹤tnsping過程SQL
- 配置SQLNET.ORA檔案跟蹤客戶端連線SQL客戶端
- [zt] oracle跟蹤檔案與跟蹤事件Oracle事件
- oracle跟蹤檔案與跟蹤事件(zt)Oracle事件
- oracle跟蹤檔案和跟蹤事件(zt)Oracle事件
- ORACLE 跟蹤工具Oracle
- 基於行跟蹤的ROWDEPENDENCIES實現資訊變化跟蹤
- 【Longkin】ASP.NET應用程式跟蹤---(一)跟蹤頁面ASP.NET
- 反跟蹤技術
- 【TRACE】Oracle跟蹤事件Oracle事件
- Oracle跟蹤會話Oracle會話
- Oracle 跟蹤事件【轉】Oracle事件
- Oracle跟蹤檔案Oracle
- 主力跟蹤戰法
- sp_trace_setfilter sqlserver篩選跟蹤或跟蹤過濾FilterSQLServer
- git的跟蹤分支和遠端跟蹤分支學習筆記Git筆記
- ORACLE 10046 設定跟蹤事件後無跟蹤檔案Oracle事件
- 除錯跟蹤利器---strace除錯
- SQLServer進行SQL跟蹤SQLServer
- 會話跟蹤技術會話
- 跟蹤執行命令T
- 給會話開跟蹤會話
- 棧呼叫關係跟蹤
- 解析listener跟蹤檔案
- oracle session(會話) 跟蹤OracleSession會話
- git 忽略跟蹤檔案Git
- 會話級SQL跟蹤會話SQL
- Oracle跟蹤事件 -- set eventsOracle事件
- (zt) 開啟事件跟蹤事件
- Oracle 10G 跟蹤Oracle 10g
- 尋找跟蹤檔案
- Oracle 跟蹤事件 set eventOracle事件
- SQL 的跟蹤方法traceSQL
- Oracle跟蹤事件和dumpOracle事件
- 檔案-跟蹤檔案
- 對session進行跟蹤Session
- oracle跟蹤事件(轉載)Oracle事件
- 像跟蹤分散式服務呼叫那樣跟蹤 Go 函式呼叫鏈分散式Go函式