代码改变世界

SQL Server 连接超时案例一则

2016-07-25 10:37  潇湘隐者  阅读(12397)  评论(0编辑  收藏  举报

   上周六,一工厂系统管理员反馈一数据库连接不上,SSMS连接数据库报“连接超时时间已到。在尝试使用预登录握手确认时超过了此超时时间.......”, 如下截图所示:

 

clipboard

 

另外远程连接也连接不上,系统管理员只能通过vSphere Client连接到这台服务器,我这边也无法远程登录检查具体情况,ping 这台服务器发现网络正常,没有丢包或时延严重情况,那我就在Linux上使用nmap扫描了一下这台服务器端口情况,发现1433端口没有开放,另外发现该服务器居然没有一个端口对外开放。

 

[oracle@DB-Server ~]$ nmap 192.xxx.xxx.xxx
 
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2016-07-23 09:28 CST
Note: Host seems down. If it is really up, but blocking our ping probes, try -P0
Nmap finished: 1 IP address (0 hosts up) scanned in 2.039 seconds

 

我检查、对比了另外一台正常的SQL Server 服务器开放的端口,如下所示:

 

[oracle@DB-Server ~]$ nmap 192.168.xxx.xxx
 
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2016-07-23 09:34 CST
Interesting ports on xxxx.xxx.xxx.com (192.168.xxx.xxx):
Not shown: 1670 filtered ports
PORT      STATE SERVICE
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
1433/tcp  open  ms-sql-s
3389/tcp  open  ms-term-serv
10000/tcp open  snet-sensor-mgmt
 
Nmap finished: 1 IP address (1 host up) scanned in 30.326 seconds

 

所以,我可以断定应该是防火墙屏蔽了所有端口,系统管理先将防火墙关闭后,一切恢复正常,后面他检查发现是因为组策导致防火墙自动启用,而这台数据库服务器没有开放相关端口。从而导致了这个问题。另外,如果网络出现延迟较严重或丢包现象,也会导致这个错误出现