We have SQL Server and 6 users are accessing same server. I just wanted to monitor quickly which queries are running currently. This T-SQL query helped me.
SELECT SPID = er.session_id
,STATUS = ses.STATUS
,[Login] = ses.login_name
,Host = ses.host_name
,BlkBy = er.blocking_session_id
,DBName = DB_Name(er.database_id)
,CommandType = er.command
,ObjectName = OBJECT_NAME(st.objectid)
,CPUTime = er.cpu_time
,StartTime = er.start_time
,TimeElapsed = CAST(GETDATE() - er.start_time AS TIME)
,SQLStatement = st.text
FROM sys.dm_exec_requests er
OUTER APPLY sys.dm_exec_sql_text(er.sql_handle) st
LEFT JOIN sys.dm_exec_sessions ses
ON ses.session_id = er.session_id
LEFT JOIN sys.dm_exec_connections con
ON con.session_id = ses.session_id
WHERE st.text IS NOT NULL
,STATUS = ses.STATUS
,[Login] = ses.login_name
,Host = ses.host_name
,BlkBy = er.blocking_session_id
,DBName = DB_Name(er.database_id)
,CommandType = er.command
,ObjectName = OBJECT_NAME(st.objectid)
,CPUTime = er.cpu_time
,StartTime = er.start_time
,TimeElapsed = CAST(GETDATE() - er.start_time AS TIME)
,SQLStatement = st.text
FROM sys.dm_exec_requests er
OUTER APPLY sys.dm_exec_sql_text(er.sql_handle) st
LEFT JOIN sys.dm_exec_sessions ses
ON ses.session_id = er.session_id
LEFT JOIN sys.dm_exec_connections con
ON con.session_id = ses.session_id
WHERE st.text IS NOT NULL
This is an interesting post. I've been wondering about this topic, so thank you for sharing it. Great post.It's really a nice and useful post.Thanks. In the fantasy world, orcs are regarded as dumb beasts. They have green skin, are very fleshy and are much less intelligent than other races. They have difficult names. Use this article for help orc name generator. You will learn about the orc name here.
ReplyDeleteYour article contains vital information for me, so I am glad to see it. Although there are a few general things I should mention, the website style is excellent, and the content is excellent. I would also like to share with you How to Make your Mouse Click Faster, especially if you are a gamer. I have listed some simple tips below to help you improve your mouse CPS.
ReplyDeleteI appreciate your insightful post! It offered much-needed clarification. For further information, I suggest reading this article Online Color Blind Test . Excellent tool for determining color blindness—very beneficial.
ReplyDeleteThank you for sharing this interesting information! It allowed me to view the topic from a new angle. For more, I suggest reading this article Geometry Dash Game . The Geometry Dash tests are an enjoyable way to practice accuracy and speed.
ReplyDeleteLoved this! The tips are so practical and easy to follow.Discover more helpful content by visiting this site f1 reaction test.Wow, the F1 reaction test was intense! I can’t believe how quickly the drivers need to respond in real races. Definitely more difficult than expected.
ReplyDelete