Skip to main content

Fun and games with the Management Data Warehouse (MDW and Data Collectors)

The SQL Server Management Data Warehouse (when you first come across it) seems to promise so much if the verbiage from Microsoft and some other websites is to to believed. But when you install it you may find that it is not as useful as it could be. This is a shame but we are currently only on v2 of the product with SQL 2012 so one hopes it will improve in subsequent versions.

However, it probably is worth playing with if you have never used it before - at least you can show your boss some reports on general server health when he asks for it and you have nothing else in place.

There is one big problem with it though if you decide that you don't want to use it any more, uninstalling it is not supported! Mad, I know. But as usual some very helpful people in the community have worked out, what seems to me, a pretty safe way of doing it.

I had a problem with my MDW. The data collector jobs were causing a lot of deadlocking on some production servers and impacting performance. It looks like there may be a workaround for it now but due to time constraints I didn't have the opportunity to investigate further so I disabled the associated SQL Agent jobs on the monitored servers. I thought I would revisit MDW in the future as it looked unlikely that my department were going to buy a 3rd party application that would offer similar functionality.

Some time later I noticed that the MDW database had grown very large, about 136G, and the server I had it running on was struggling for space. This was odd because I thought data wasn't being uploaded to it.

There is purge job that is installed by default called mdw_purge_data_[MDW] but though it was running each day didn't seem to clear much data out so I could shrink the file. Looking at the SP that is run by this job, core.sp_purge_data, it took some parameters so I thought I would try and execute it for each monitored instance. The parameters are:


Making an educated guess that I could set @retention_days and @duration to 1, all I had to do was find the values for @instance_name and @collection_set_uid. To do so I ran this query against the MDW database:

--Show the databases that have been configured for MDW
SELECT DISTINCT [instance_name]
FROM [MDW].[core].[snapshots]

I used the results as parameters for the the core.sp_purge_data stored procedure but even though it appeared to delete several thousand rows, not much space was released . Meanwhile, the database kept growing. There was only one thing for it - I had to "uninstall" MDW and set it up again. The  article did the job for me on this 2008R2 server.

I have reinstalled MDW now and am only monitoring one server for the moment while keeping an eye on the amount of data that is being collected. But to help out matters I have enabled page compression on some tables that I identified previously which had grown very large. They are:


To generate that list of tables I used the following query:

SELECT SCHEMA_NAME(sys.objects.schema_id) AS [SchemaName]
       ,OBJECT_NAME(sys.objects.object_id) AS [ObjectName]
       ,[index_id] AS [IndexID_on_Table]
FROM sys.partitions
INNER JOIN sys.objects
       ON sys.partitions.object_id = sys.objects.object_id
WHERE data_compression > 0
       AND SCHEMA_NAME(sys.objects.schema_id) <> 'SYS'
ORDER BY SchemaName

We are now rolling out SCOM so it will be interesting to see what sort of statistics I will be able to generate from it. The reports won't be as useful as those from Confio Ignite, for instance, but it will have to do for now.


  1. Hey Paulie,

    Excellent article and hopefully, better things to come for MDW in 2014+

  2. Very good article and a topic for discussion. I completely agree with the author that the expectations of the program are at variance with its opportunities and it is sad.
    Because as a supplement to the article and how the exchange of useful information to share with you a very useful resource that meets all the expectations from him virtual data rooms for mergers and acquisitions.


Post a Comment

Popular posts from this blog

How to move the Microsoft Assessment and Planning Toolkit (MAP) database to a different drive

The Microsoft Assessment and Planning Toolkit (MAP) is a very useful tool for scanning your network to find instances of SQL Server plus all manner of detailed information about the installed product, OS and hardware it sits on.

<Click image to enbiggen>
There is an issue with it the database it uses to store the data it collects, however. Assuming you don't have an instance called MAPS on your server, the product will install using LocalDB (a cut down version of SQL Server Express) and puts the databases on your C: drive. If you then scan a large network you could easily expand the database to 10GB which may cause issues on a server when that drive is often one of the smallest. However, there is a simple solution: connect to LocalDB using Management Studio, detach the databases, move to a different drive, set permissions on the new location if required and reattach the database. How do you connect to LocalDB? Here you go:

Connect to (localdb)\MAPTOOLKIT

The databases I move…

Generate scripts to attach multiple databases

There is a handy little "by product", if you like, when running queries which means you can quickly generate scripts to do different things. Below is an example of generating multiple "attach" commands that you can copy from the results pane into the main SSMS window for execution. I have found this very handy in the past:

SELECT 'CREATE DATABASE ['+name+'] ON ( FILENAME = N''F:\MSSQL\Data\'+name+'.mdf'' ), ( FILENAME = N''E:\MSSQL\Log\'+name+'_log.ldf'' )  FOR ATTACH GO ' FROMmaster.dbo.sysdatabases WHEREnamenotin('master','msdb','model','tempdb')

The AcquireConnection method call to the connection manager failed with error code 0xC0202009

I had one of those annoying problems with executing a SSIS package that took up most of the morning today (and a couple of hours yesterday) where you get an error which many people have had, but none of their solutions work. I guess it is such a generic error code it can relate to many different issues hence dozens of different (wrong) suggestions. What confused matters was that although it completed successfully in SSDT, it failed when being validated on our newly created SSISDB Catalog. I didn't know whether it was a problem with the package and/or its parameters or the SSISDB Catalog installation or Environment.

If you haven't set up an Integration Services Catalog (a new feature of SQL 2012) yet I definitely think it is worth looking at. I found an excellent guide here that takes you through it all.

In our case we had two connection managers, the source was a table in a SQL Server 2012 database and the destination a table in an Access 2010 database. The server with the Int…