使用T-SQL语句配置SQL Server连接池允许的并发用户连接的最大数目

exec sp_configure 'show advanced options', 1
go
RECONFIGURE --运行RECONFIGURE语句进行安装,使以上语句生效
结果:配置选项 'show advanced options' 已从 0 更改为 1。请运行 RECONFIGURE 语句进行安装。
exec sp_configure 'user connections', 10
go
RECONFIGURE --运行RECONFIGURE语句进行安装,使以上语句生效
结果:配置选项 'user connections' 已从 0 更改为 10。请运行 RECONFIGURE 语句进行安装。
第一句表示显示sp_configure 系统存储过程高级选项,使用user connections 时,要求show advanced options 值为1。
第二句配置最大连接数为10,0 表示不限制,但不表示无限制。
--------------------------------------------------------------------
也可以在企业管理器中配置,在SQLServer实例上点右键->“属性”->“连接”里面更改。
更新参数后需要重新启动SQL Server,该值才会生效。
全局变量:@@max_connections
select @@max_connections
它总是返回32767,它并不是指上面设置的user connections,实际上它表示user connections 最大可设置为多少。
由于它的最大值是32767,那么user connections 为0 时,最大连接数也就是32767。
默认情况下user connections 值是0,也就是说默认情况下SQL Server 的最大连接数是32767。
获得当前设置的最大连接数:
select value from master.dbo.sysconfigures where [config]=103

扫一扫加作者微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网