In this post I provide you a different script to find out running sessions and processes in SQL Server.
As a DBA, this is very much important to find all current running sessions and processes of SQL Server.
Below is different three ways to find all running process of SQL Server.
First, Using SP_WHO & SP_WHO2:
This both command is used to check and monitor current running connections and sessions of SQL Server.
SP_WHO : provides information like: Session ID, Logged User ID, Host Name, Session Status, Blocked Process, Database Name, Command Details, Request ID.
SP_WHO2 : provides some additional information like : CPU Time by each session, no of Disk Reads, Last query execution time
Second, Using sysprocesses View:
DB_NAME(DBID) AS DataBaseName
,COUNT(DBID) AS NumberOfConnections
WHERE DBID > 0
GROUP BY DBID, LogiName
Third, Using dm_exec_requests:
,est.TEXT AS QueryText
FROM sys.dm_exec_requests AS der
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS est
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.