赞
踩
查看最大连接数
SELECT @@MAX_CONNECTIONS
查看指定数据库的连接数
SELECT * FROM master.dbo.sysprocesses WHERE dbid IN
(
SELECT dbid FROM master.dbo.sysdatabases
WHERE NAME='DB_WMS_KZJ'
)
获取当前SQL服务器所有的连接详细信息
SELECT * FROM sysprocesses
获取自上次启动 SQL Server服务 以来连接或试图连接的次数
SELECT @@CONNECTIONS
查看连接数
select hostname 主机名,count(*) 连接数量 from master.dbo.sysprocesses group by hostname order by count(*) desc
或者
SELECT login_name,
Count(0) user_count
FROM Sys.dm_exec_requests dr WITH(nolock)
RIGHT OUTER JOIN Sys.dm_exec_sessions ds WITH(nolock)
ON dr.session_id = ds.session_id
RIGHT OUTER JOIN Sys.dm_exec_connections dc WITH(nolock)
ON ds.session_id = dc.session_id
WHERE ds.session_id > 50
GROUP BY login_name
ORDER BY user_count DESC
参考:
https://m.656463.com/wenda/rhcxSQLSERVERzljcdzdljs6496_77
https://blog.csdn.net/w13511069150/article/details/115396501
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。