Playing Doctor with DMVs

SQL Server 2005 and newer come with Dynamic Management Views (DMVs) that can help you conquer some tough troubleshooting challenges.  In this one-hour video, I show you how to find hyperactive files & filegroups, catch potential partitioning pitfalls, sniff out heaps, and use a Central Management Server to triage your servers.

Here’s my favorite DMV queries from around the web:

SQL Server’s Medical File – sys.dm_os_wait_stats – this DMV shows what SQL Server has been waiting on since the last time it restarted (or the last time someone reset the DMV using DBCC SQLPERF).

SQL Server’s Current Pulse – sys.dm_exec_requests – this view shows what’s executing right now on the server.  To be useful, you have to join it to a few other DMVs, but thankfully there’s a bunch of good queries already written for you:

SQL Server’s Recent Medical History – sys.dm_exec_query_plan – shows queries in the procedure cache that have been executing recently.  This particular set of DMVs is a little less reliable than the rest because the contents can change at any time based on how much memory your server has, but nonetheless, it’s a great way to see what you missed a few minutes ago.

SQL Server Index Health – the index DMVs are controversial among experts because they frequently get abused.  Just because SQL Server’s DMVs suggest that you should add an index doesn’t really mean you should.  Be careful when you’re using these.

And check out my other free SQL Server training videos.