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

Posted by Tamarick Hill on SQL Blog See other posts from SQL Blog or by Tamarick Hill
Published on Tue, 02 Jul 2013 15:26:00 GMT Indexed on 2013/07/02 17:11 UTC
Read the original article Hit count: 687

Filed under:

 

This sys.dm_exec_sessions DMV is another Server-Scoped DMV which returns information for each authenticated session that is running on your SQL Server box. Lets take a look at some of the information that this DMV returns.

SELECT * FROM sys.dm_exec_sessions

image

image

image

This DMV is very similar to the DMV we reviewed yesterday, sys.dm_exec_requests, and returns some of the same information such as reads, writes, and status for a given session_id (SPID). But this DMV returns additional information such as the Host name of the machine that owns the SPID, the program that is being used to connect to SQL Server, and the Client interface name. In addition to this information, this DMV also provides useful information on session level settings that may be on or off such as quoted identifier, arithabort, ansi padding, ansi nulls, etc. This DMV will also provide information about what specific isolation level the session is executing under and if the default deadlock priority for your SPID has been changed from the default. Lastly, this DMV provides you with an Original Login Name, which comes in handy whenever you have some type of context switching taking place due to an ‘EXECUTE AS’ statement being used and you need to identify the original login that started a session.

For more information on this DMV, please see the below Books Online link:

http://msdn.microsoft.com/en-us/library/ms176013.aspx

© SQL Blog or respective owner

Related posts about DMV's