[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

how to know number of connections in active mode

Hi experts,

how to know number of connections active with database ,  how to maintain less number of  connections with database . i am using sqlsever 2005
0
gpinfotech
Asked:
gpinfotech
  • 3
  • 3
1 Solution
 
DhaestCommented:
You can run a query on your system to see how many active connections there are

How to see active connections for each Database in SQL Server 2005
http://www.sqlservercurry.com/2008/03/how-to-see-active-connections-for-each.html
SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

Open in new window

0
 
gpinfotechAuthor Commented:
i want to know active connections with sqlserver when i am using asp.net webapplication. when i am using above query always it is showing one connection only!
0
 
DhaestCommented:
Did you check the NoOfConnections in asp.net when you run the query ?

Try this (without the username):

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gpinfotechAuthor Commented:
now also i am getting one connection only !
0
 
DhaestCommented:
When I execute this query on my database, I get 51 rows (grouped by database), with some have a connection of 51 users, while others only have 0.

If you only want to have the connections, without knowing to which database, you can use this
SELECT count(dbid) as NoOfConnections
FROM sys.sysprocesses
WHERE dbid > 0

(you can add filters on the status fe)
0
 
gpinfotechAuthor Commented:
Hi thank u for ur reply
0
 
Amandeep Singh BhullarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now