2016-10-04 132 views
0

是否有可能通过查询找出有多少用户平均连接到SQL Server以及有多少用户一次最多连接到SQL Server?查询SQL Server查找平均和最大连接用户数

(我问这句话,看看我超过了客户端访问icence。)

示例查询的结果将是3列DatabaseMax. Connections (today)Average connections (today)

回答

0

你不能得到多少连接都使用的今天当前DMV's..But你可以得到总开连接到目前为止每个数据库数由..

select 
db_name(dbid) as databasename, 
count(*) 
from sys.sysprocesses 
where dbid>0 
group by dbid 

如果您正在使用计划区分连接字符串名称,您还可以进一步隔离客户端

select 
    db_name(dbid) as databasename, 
    count(*) as cnt,program_name 
    from sys.sysprocesses 
    where dbid>0 
    group by dbid,program_name