Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

Determine users connected to sqlserver database

  • 18 March 2010
  • Author: indupriya
  • Number of views: 154778
  • 0 Comments

There are three ways to find who is connected to a database in sqlserver. 

First one:

  • Use the SQL SERVER Management Studio -- Management -- Activity Monitor
  • This gives a list of users, database names, status, command, transactions, application with which they are using the database, CPU, IO and Memory usage, Login time etc.

 

Second One:

  • Use the built in stored procedure called sp_who2
  • Run the command exec sp_who2
  • This gives a list of users, database names, status, command, program with which they are using the database, CPU time, Login time etc.

Third One:

  • Use the script

select spid, status, loginame, hostname, blocked, db_name(dbid), cmd from master..sysprocesses where db_name(dbid) = 'databasename'

 

This gives the status, login name and host name for the database you specify.

 

 

 

Print
Categories: Blogs
Tags:
Rate this article:
5.0

indupriyaindupriya

Other posts by indupriya

Please login or register to post comments.