Monday, December 22, 2008

Show number of active database connections in SQL Server

one of common problems in Sql serverl is pool over because of open connections are not closed.

sp_who2 will help you to see open connections to your SQL database engine.

this is screenshot of the result of the run



SELECT @@MAX_CONNECTIONS AS 'Max Allowed Connections'

to have select query on sp_who to see the connection of specific database



SELECT SPID,

STATUS,

PROGRAM_NAME,

LOGINAME=RTRIM(LOGINAME),

HOSTNAME,

CMD

FROM MASTER.DBO.SYSPROCESSES

WHERE DB_NAME(DBID) = 'DB_Name' AND DBID != 0

1 comment: