DBA Utility Belt: What’s Happening?

There are some nice system stored procedures and DMVs which provide you information on what’s going on within SQL Server at any time.

This procedure returns active queries:

SELECT   
	st.text, 
	r.session_id, 
	r.status, 
	r.command, 
	r.cpu_time, 
	r.total_elapsed_time
FROM 
	sys.dm_exec_requests r
	CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st;

sp_who2 is a very quick source for what’s going on with regard to sessions:

exec sp_who2

To be honest, though, I really prefer Adam Machanic’s sp_WhoIsActive for all of this work. I would consider it the single best stored procedure publically available.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s