July, the 31 Days of SQL Server DMO’s – Day 1 (sys.dm_exec_requests)

Posted by Tamarick Hill on SQL Blog See other posts from SQL Blog or by Tamarick Hill
Published on Mon, 01 Jul 2013 16:18:18 GMT Indexed on 2013/07/01 17:11 UTC
Read the original article Hit count: 527

Filed under:

The first DMO that I would like to introduce you to is one of the most common and basic DMV’s out there. I use the term DMV because this DMO is actually a view as opposed to a function. This DMV is server-scoped and it returns information about all requests that are currently executing on your SQL Server instance. To illustrate what this DMV returns, lets take a look at the results.

image

image

image

image

As you can see, this DMV returns a wealth of information about requests occurring on your server. You are able to see the SPID, the start time of a request, current status, and the command the SPID is executing. In addition to this you see columns for sql_handle and plan_handle. These columns (when combined with other DMO’s we will discuss later) can return the actual sql text that is being executed on your server as well as the actual execution plan that is cached and being used. This DMV also returns information about various wait types that may be occurring for your spid. The percent_complete column displays a percentage to completion for certain database actions such as DBCC CheckDB, Database Restores, Rollback’s, etc. In addition to these, you are also able to see the amount of reads, writes, and cpu that the SPID has consumed.

You will find this DMV to be one of the primary DMV’s that you use when looking for information about what is occurring on your server.

© SQL Blog or respective owner