Number of open/active connections in ms sql server 2005

written by Amr ElGarhy on Sunday, March 22 2009

How to get total number of open/active connections in MS SQL Server 2005?

SELECT DB_NAME(dbid) as 'Database Name', 
COUNT(dbid) as 'Total Connections' 
FROM master.dbo.sysprocesses WITH (nolock)
WHERE dbid > 0
GROUP BY dbid
SELECT @@MAX_CONNECTIONS AS 'Max Allowed Connections'

This shows the no of connections per each DB:

SELECT 
    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
GROUP BY 
    dbid, loginame

 

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'
Digg It!  StumbleUpon  Reddit  Del.icio.us  NewsVine  Furl  BlinkList  Ma.gnolia  Technorati

Similar Posts

  1. Websites and Web Projects
  2. Developers/Job Seekers, did you consider Stackoverflow?
  3. 10+ Ways for testing website browser compatibility

Post a comment

Options:

Size

Colors