sqlskills-logo-2015-white.png

SQL Server Diagnostic Information Queries for September 2016

This month, I have a couple of new queries in the SQL Server 2012, 2014 and 2016 sets, along with additional comments and documentation in the SQL Server 2012, 2014 and 2016 sets.  I have gotten quite a bit of interest about making a special version of these queries for SQL Database in Microsoft Azure. So, I will be doing that during September (this time for sure).

The best way to learn how to interpret the results of all of these queries is to attend my all-day PASS Summit 2016 Pre-Conference Session on Monday, October 24, 2016.

Dr. DMV: How to Use DMVs to Diagnose Performance Problems

 

Rather than having a separate blog post for each version, I have just put the links for all six major versions in this single post. There are two separate links for each version. The first one on the top left is the actual diagnostic query script, and the one below on the right is the matching blank results spreadsheet, with labeled tabs that correspond to each query in the set. 

Here are links to the latest versions of these queries for SQL Server 2016, 2014 and 2012:

SQL Server 2016 Diagnostic Information Queries (September 2016)

SQL Server 2016 Blank Results

SQL Server 2014 Diagnostic Information Queries (September 2016)

SQL Server 2014 Blank Results

SQL Server 2012 Diagnostic Information Queries (September 2016)

SQL Server 2012 Blank Results

Here are links to the most recent versions of these scripts for SQL Server 2008 R2 and older:

Since SQL Server 2008 R2 and older are out of Mainstream support from Microsoft (and because fewer of my customers are using these old versions of SQL Server), I am not going to be updating the scripts for these older versions of SQL Server every single month going forward.  I started this policy a while ago, and so far, I have not heard any complaints. I did update these queries slightly in January 2016 though.

SQL Server 2008 R2 Diagnostic Information Queries (CY 2016)

SQL Server 2008 R2 Blank Results

SQL Server 2008 Diagnostic Information Queries (CY 2016)

SQL Server 2008 Blank Results

SQL Server 2005 Diagnostic Information Queries (CY 2016)

SQL Server 2005 Blank Results

The basic instructions for using these queries is that you should run each query in the set, one at a time (after reading the directions for that query). It is not really a good idea to simply run the entire batch in one shot, especially the first time you run these queries on a particular server, since some of these queries can take some time to run, depending on your workload and hardware. I also think it is very helpful to run each query, look at the results (and my comments on how to interpret the results) and think about the emerging picture of what is happening on your server as you go through the complete set. I have quite a few comments and links in the script on how to interpret the results after each query.

After running each query, you need to click on the top left square of the results grid in SQL Server Management Studio (SSMS) to select all of the results, and then right-click and select “Copy with Headers” to copy all of the results, including the column headers to the Windows clipboard. Then you paste the results into the matching tab in the blank results spreadsheet.

About half of the queries are instance specific and about half are database specific, so you will want to make sure you are connected to a database that you are concerned about instead of the master system database. Running the database-specific queries while being connected to the master database is a very common mistake that I see people making when they run these queries.

Note: These queries are stored on Dropbox. I occasionally get reports that the links to the queries and blank results spreadsheets do not work, which is most likely because Dropbox is blocked wherever people are trying to connect.

I also occasionally get reports that some of the queries simply don’t work. This usually turns out to be an issue where people have some of their user databases in 80 compatibility mode, which breaks many DMV queries, or that someone is running an incorrect version of the script for their version of SQL Server.

It is very important that you are running the correct version of the script that matches the major version of SQL Server that you are running. There is an initial query in each script that tries to confirm that you are using the correct version of the script for your version of SQL Server. If you are not using the correct version of these queries for your version of SQL Server, some of the queries are not going to work correctly.

If you want to understand how to better run and interpret these queries, you should consider listening to my three latest Pluralsight courses, which are SQL Server 2014 DMV Diagnostic Queries – Part 1SQL Server 2014 DMV Diagnostic Queries – Part 2 and SQL Server 2014 DMV Diagnostic Queries – Part 3. All three of these courses are pretty short and to the point, at 67, 77, and 68 minutes respectively. Listening to these three courses is really the best way to thank me for maintaining and improving these scripts…

Please let me know what you think of these queries, and whether you have any suggestions for improvements. Thanks!

7 thoughts on “SQL Server Diagnostic Information Queries for September 2016

  1. Hi, The SQL 2016 script is giving an error on a column named t.remote_data_archive_migration_state_desc. It states that it does not exists. Thanks for the great scripts again! Very helpful. Regards, Gé

    1. Forgot to mention: The version I am having this issue with is: Microsoft SQL Server 2016 (RTM) – 13.0.1601.5 (X64) Apr 29 2016 23:23:58 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 6.3 (Build 10586: ) (Hypervisor)

  2. Hi Glenn,

    Firstly many, many thanks for providing and continuing to update the diagnostic queries to the SQL Server Community. I’ve found them an invaluable resource during my (continuing) journey to try and understand more of how SQL Server works.

    I’m using the SQL Server 2008 R2 Diagnostic Information Queries version and have a query about interpreting the results of the (Buffer Usage) query. If this isn’t an appropriate channel to be asking this query apologies and no problem at all.

    When i see multiple instances of the same object name KCustomProperty0000000001 e.g. what does this mean?

    Object Name index_id Buffer size(MB)
    KCustomProperty0000000001 1 208.95
    KCustomProperty0000000005 1 189.21
    KCustomProperty0000000003 1 174.02
    KCustomProperty0000000001 1 100.67
    KCustomProperty0000000005 1 91.05
    KCustomProperty0000000004 1 85.16
    KCustomProperty0000000003 1 82.59

    Thanks,
    George

    1. Thanks for the kind words! If the object name and index ID are the same, that probably means it is a partitioned table. If that is not the case, then it could be an issue with the query.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.