TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 03-12月-2010 09:49:43
Copyright (c) 1997,<wbr> 2007, Oracle.<wbr> All rights reserved.</wbr></wbr>
已使用的参数文件:
d:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.19
7)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun)))
OK (20 毫秒)
C:\Users\nowhill>lsnrctl stop
LSNRCTL for 32-bit Windows: Version 10.2.0.4.0 - Production on 03-12月-2010 09:49:51
Copyright (c) 1991, 2007, Oracle.<wbr> All rights reserved.</wbr>
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
命令执行成功
C:\Users\nowhill>tnsping test_sun
TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 03-12月-2010 09:49:59
Copyright (c) 1997,<wbr> 2007, Oracle.<wbr> All rights reserved.</wbr></wbr>
已使用的参数文件:
d:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.19
7)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun)))
TNS-12541: TNS: 无监听程序<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> --tnsping会检测监听是否启动</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
C:\Users\nowhill>lsnrctl start
LSNRCTL for 32-bit Windows: Version 10.2.0.4.0 - Production on 03-12月-2010 09:50:23
Copyright (c) 1991, 2007, Oracle.<wbr> All rights reserved.</wbr>
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 10.2.0.4.0 - Production
系统参数文件为d:\oracle\product\10.2.0\db_1\network\admin\listener.ora
写入d:\oracle\product\10.2.0\db_1\network\log\listener.log的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.197)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
LISTENER 的 STATUS
------------------------
别名<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> LISTENER<br> 版本<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> TNSLSNR for 32-bit Windows: Version 10.2.0.4.0 - Production<br> 启动日期<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> 03-12月-2010 09:50:27<br> 正常运行时间<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> 0 天 0 小时 0 分 5 秒<br> 跟踪级别<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> off<br> 安全性<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> ON: Local OS Authentication<br> SNMP<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> OFF<br> 监听程序参数文件<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> d:\oracle\product\10.2.0\db_1\network\admin\listener.ora<br> 监听程序日志文件<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> d:\oracle\product\10.2.0\db_1\network\log\listener.log<br> 监听端点概要...<br><wbr> (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))<br><wbr> (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.6.197)(PORT=1521)))<br> 服务摘要..<br> 服务 "PLSExtProc" 包含 1 个例程。<br><wbr> 例程 "PLSExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...<br> 服务 "stor" 包含 1 个例程。<br><wbr> 例程 "stor", 状态 UNKNOWN, 包含此服务的 1 个处理程序...<br> 服务 "sun" 包含 1 个例程。<br><wbr> 例程 "sun", 状态 UNKNOWN, 包含此服务的 1 个处理程序...<br> 命令执行成功</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
--修改test_sun的配置,把SERVICE_NAME = sun 改为 SERVICE_NAME = sun2
C:\Users\nowhill>tnsping test_sun
TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 03-12月-2010 09:50:44
Copyright (c) 1997,<wbr> 2007, Oracle.<wbr> All rights reserved.</wbr></wbr>
已使用的参数文件:
d:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.19
7)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = sun2)))
OK (10 毫秒)<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> --但是tnsping 并不检测SERVICE_NAME是不是存在</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
C:\Users\nowhill>sqlplus test/test@test_sun
SQL*Plus: Release 10.2.0.4.0 - Production on 星期五 12月 3 09:52:51 2010
Copyright (c) 1982, 2007, Oracle.<wbr> All Rights Reserved.</wbr>
ERROR:
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
请输入用户名:
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
总结:1.tnsping 命令可以检查tcp协议是否已同,俗称我们说的网络通不通
<wbr><wbr><wbr><wbr><wbr><wbr>2.tnsping命令监听服务器上的监听是否已开启</wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><wbr> 3.tnsping命令不检测服务器上的监听的服务名,所以tnsping通,不代表就能连通。</wbr></wbr></wbr></wbr></wbr>