Sql Dynamic Managment views

dynamic_management_views_HOW to

 This is  very elemental only and is provided as a lamen view of troublshooting with this tool.  This is a very powerful feature that I would love to see a very good break down on on  how to make this feature easy. I suppose the answer is just to use it every day. Ah how nice it would be to do one thing every day!

Driving down the dirt road with dynamic management views:

 After looking at DMV. I think you have to know exactly what you are looking for before you use them. You may find something in the event log that gives you something specific. In this case you may need a “how to” to do this on the fly.

 A list of the DMV’s:


  1. Then you need to start basic by pulling up the desired view from the list. Right click the database and click new query inside SQL Management Studio; then type the following:

Select * from sys.dm_ Place_your_title_from_the_list (Putting SYS.DM is essential!)

With tab completion you just need to know to type sys.dm_ .  Do you get it/ we are just using tab completion to bring up a query for the right value.

You will get a list of the possible items you can pull up. Here are the major categories:

sys.dm_exec_* – provide information about execution of .NET CLR Modules and connections. All contained here are a number of views available to help you drill into issues related to execution of queries.

  1. sys.dm_os_* – report on memory, locks, and execution scheduling.
  2. sys.dm_trans_* – provide insight into transactions and isolation.
  3. sys.dm_io_*. – monitoring disk I/O
  4. Sys.dm_db_* – provide database-level data.

 Here is an example of things you might pull up:


 To make a free form query you may start with a format for a specific database. I am writing the query based on the column names in the results below:

select sys query 

I want to see the lock request /second for all instances – example (line 133)

The query would look like

Select instance_name,

Cntr_value, ‘lock request/sec’

From sys.dm_os_performance_counters

Where counter_name = ‘lock request/sec’

The cleaned up query looks like:

Select instance_name,

Cntr_value, ‘lock request/sec’

From sys.dm_os_performance_counters

Where counter_name = ‘lock request/sec’

Of course retuns no results.

Trying another one: I just searched until I found one that turned a lot of results:

select * from sys.dm_os_memory_cache_counters


select * from sys.dm_os_memory_cache_counters

 arbitrartily decided I wanted to see single pages over 100k- see below:

select name,

single_pages_kb ‘Memory over 100k’

 from sys.dm_os_memory_cache_counters

where single_pages_kb > ‘100’


 You can see the result in the window. Here is a good article about the subject. This person is much more knowledgable on the subject, but she did give me the courage to delve in and try to understand. Tab completion does make this easier and you do get used to it. Just learn to memoruze the sys. to begin the tabbed search feature.



BONUS SP_configure – What is it!!


USE master


EXEC sp_configure ‘show advanced option’,’1′



Some examples in the link above – the commands for SP_configure below



For a list of settings :

SELECT * FROM sys.configurations

ORDER BY name ;


Running stored procedures:

exec sp_

type this in the query window for a list

Good list of stored procedures

List of 2008 DMV

use master


SELECT * FROM sysobjects

WHERE name LIKE ‘dm_%’

AND name NOT IN(‘dm_os_hosts’,


























































































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