很多时候自己本地开发会遇到 ,打开几个连接正常访问 之后就报错误,这时候需要调整sqlserver 最大连接数.

1. 查询最大连接数

SELECT value_in_use
FROM sys.configurations c
WHERE c.name = 'user connections';

默认值为:0,即无限制。

2. 查询当前连接数

select count(distinct(login_time)) from sys.sysprocesses

3. 设置最大连接数

exec sp_configure 'show advanced options', 1
GO

RECONFIGURE WITH OVERRIDE
GO

exec sp_configure 'user connections', 300
GO

RECONFIGURE WITH OVERRIDE
GO

设置过后需要重启数据库才会生效。
---------------------
作者:duanbeibei
来源:CSDN
原文:https://blog.csdn.net/duanbeibei/article/details/86573840