很多时候自己本地开发会遇到 ,打开几个连接正常访问 之后就报错误,这时候需要调整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

设置过后需要重启数据库才会生效。

很多时候自己本地开发会遇到 ,打开几个连接正常访问 之后就报错误,这时候需要调整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

设置过后需要重启数据库才会生效。

相关文章:

  • 2022-01-16
  • 2021-10-10
  • 2022-12-23
  • 2021-12-07
  • 2021-05-21
  • 2021-11-26
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-02-06
  • 2021-11-19
  • 2022-12-23
  • 2021-05-29
相关资源
相似解决方案