1. 最大连接数
select @@MAX_CONNECTIONS
2. 有史以来连接的数量?
SELECT @@CONNECTIONS
3. 不同用户登录的连接数
select loginame,count(1) as Nums from sys.sysprocesses group by loginame order by 2 desc
?4. 详细连接及客户端进程号
SELECT? DB_NAME(dbid) as DBName,? COUNT(dbid) as NumberOfConnections, loginame as LoginName, hostname, hostprocess FROM sys.sysprocesses with (nolock) WHERE? dbid > 0 GROUP BY? dbid, loginame, hostname, hostprocess
5. 其他
SELECT DB_NAME(dbid) as DBName, hostname ,COUNT(dbid) as NumberOfConnections FROM sys.sysprocesses with (nolock)? WHERE dbid > 0? and len(hostname) > 0? --and DB_NAME(dbid)='master' /* Open this line to filter Database by Name */ Group by DB_NAME(dbid),hostname order by DBName?
|