Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Monitor Current queries executing on SQL Server

15 September,2012 by Tom Collins

I use this query to get list of queries  executing on the current SQL Server including the query text 

The sys.dm_exec_requests DMV returns a list of executing requests on SQL Server. To view the SQL code , there’s a reference to sys.dm_exec_sql_text  which returns the text base don the sql_handle.

Use the query to get a quick overview of any slow running queries  . Then drill down into the request to see why it’s causing a problem. Such as SQL Server – sys.dm_exec_sessions and troubleshooting sql memory usage

SELECT 
r.session_id,
s.TEXT,
r.[status],
r.blocking_session_id,
r.cpu_time,
r.total_elapsed_time
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s 

Read More

Top 5 SQL Server DMV for Index Analysis

SQL Server - Find all DMV and DMF

SQL Server sql_handle returns sql statement


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Monitor Current queries executing on SQL Server


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer