远程访问数据库报错:
[Microsoft][SQL Server Native Client 10.0]TCP 提供程序: 远程主机强迫关闭了一个现有的连接。
[Microsoft][SQL Server Native Client 10.0]通讯链接失败
网上找了一堆文章照着做都没有效果,后来请教微软专家给的解决方案:
1、执行 exec sp_configure
2、查看remote login timeout (s) 设置时间是多少秒,一般默认为10秒。
3、执行
GO
EXEC sp_configure 'remote login timeout', 35 ;
GO
RECONFIGURE ;
GO
变更为35秒后观察了一个月多月,再没犯病。
最近启用了一台性能一般的数据库服务器,用了上面的方法还是犯病,只能追加作业杀掉sleeping的进程了。
declare @s nvarchar(100)
declare tb cursor local
for
select N'kill '+rtrim(spid) from sysprocesses where status='sleeping' and spid> =50 and loginame !='需要保留的进程loginame'
open tb
fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb