有时我会遇到 Oracle 连接问题,因为我无法确定数据库客户端正在使用哪个 tnsnames.ora 文件。
解决这个问题的最佳方法是什么?++对各种平台解决方案感到满意。
最佳答案
Oracle 提供了一个名为 tnsping
的实用程序:
R:\>tnsping someconnection
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:38:07
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora
TNS-03505: Failed to resolve name
R:\>
R:\>tnsping entpr01
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:39:22
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = **)
(PROTOCOL = TCP) (Host = ****) (Port = 1521))) (CONNECT_DATA = (SID = ENTPR0
1)))
OK (40 msec)
R:\>
这应该显示您正在使用的文件。该实用程序位于 Oracle bin
目录中。
关于Oracle - 我使用什么 TNS 名称文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10499/