Change the value of "Maximum number of concurrent connections" about SQL Server 2012

默认值:"Maximum number of concurrent connections" 是0

Run "sp_configure  'user connection'  query:

sp_configure  'user connection'

关于Maximum number of concurrent connections 的具体设置和测试:

配置:

https://msdn.microsoft.com/zh-cn/library/ms187030.aspx

测试:

http://www.xumenger.com/sqlserver-conn-20160606/


我在操作过程中遇到一个问题,当我把

Maximum number of concurrent connections 改为1后,发现不能通过ssms等方式连接sql,查看日志,报错:

2017-05-08 18:49:51.60 Logon       Could not connect because the maximum number of '1' user connections has already been reached. 
The system administrator can use sp_configure to increase the maximum value. The connection has been closed. [CLIENT: <local machine>]
2017-05-08 18:49:55.79 Logon       Error: 17809, Severity: 20, State: 3.

关于这个问题的解决方案:

1. 在SQL Server Configuration服务中,关闭所有相关的sql服务,除了SQL Server, 以为我的机器为例,使用SQL Server 2012


2.右键SQL Server(SQL2012),打开Properties->Startup Parameters, 添加-m


点击ok确认(需重启service)。

对比Startup Parameters :

添加-m之前:                            

  添加-m之后:


此时可以通过sqlcmd启动service

3.打开cmd,

start service:

Net Start <sqlservername> /mSQLCMD

sqlservername就是你的sql service 的名字。


链接instance: (使用sa)

sqlcmd -S. -Usa

然后根据提示输入密码,连接成功。


修改user connections为0:

EXEC sp_configure 'show advanced options', 1;  
GO  
RECONFIGURE ;  
GO  
EXEC sp_configure 'user connections', 0 ;  
GO  
RECONFIGURE;  

修改完后退出


stop service:

Net Stop<sqlservername> /mSQLCMD


4.此时user connection的值已经修改成功,重启service后就可以生效。

但此时再次连接,会继续报错:



这是因为刚开始我们修改了Startup Parameters,导致Server模式为single user mode。 

这时只要删除掉-m参数在重启服务就可以了。



6.再次通过ssms链接,测试成功。

猜你喜欢

转载自blog.csdn.net/bosbear/article/details/71439017
今日推荐