Viewing who is connected

  • Hello SQLers!

    I was wondering if there was a way through Enterprise Manager (or some other source) where I can view who has a connection open to a database.

    If you're wondering, I have an application in which several sources are trying to access the database simultaneously (by design), but when I want to do a database RESTORE, I have to make sure that noone has a connection reference to the database.

    I would like to be able to determine who has a connection open in order to debug my application efficiently.

    Thank you and have a great day!

  • In the Query Analyzer you can execute sp_who or sp_who2

    You can also check out this thread:

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=169&messageid=184838

  • Run sp_who in Query Analyzer to view the connections to the current database.

    See Brian Knight's stored procedure, usp_Kill_Users, to find a useful way to break those connections so you can place the db in single-user mode.

    HTH

    Elliott

  • You can also look in Enterprise Manager -> management folder -> current activity -> process info.

    From this screen you can see all connections and kill users.

  • Thank you for your help!

    The information is awesome!

  • You can also use sysprocesses system table in query analyser where you can decide which are the fields you want..Like cpu,IO utalization,machine name,spid,loginame etc...

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply