如何确定打开/活动连接的总数在ms sql server 2005中 [英] How to determine total number of open/active connections in ms sql server 2005
问题描述
我的PHP / MS Sql Server 2005 / win 2003应用程序偶尔变得非常无响应,内存/ cpu使用不尖峰。如果我尝试从sql管理工作室打开任何新的连接,那么它只是挂在打开的连接对话框。
如何确定活动连接的总数ms sql server 2005
My PHP/MS Sql Server 2005/win 2003 Application occasionally becomes very unresponsive, the memory/cpu usage does not spike. If i try to open any new connection from sql management studio, then the it just hangs at the open connection dialog box. how to deterime the total number of active connections ms sql server 2005
推荐答案
DB:
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
/ p>
And this gives the total:
SELECT
COUNT(dbid) as TotalConnections
FROM
sys.sysprocesses
WHERE
dbid > 0
如果您需要更多详细信息,请运行:
If you need more detail, run:
sp_who2 'Active'
所使用的SQL Server帐户需要sysadmin角色(否则只显示一行,计数结果为1)
Note: The SQL Server account used needs the 'sysadmin' role (otherwise it will just show a single row and a count of 1 as the result)
这篇关于如何确定打开/活动连接的总数在ms sql server 2005中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!