This article describes an update that enables you to exclude system databases from a Query Statistics collection set when you use the management data warehouse in Microsoft SQL Server 2008 R2, Microsoft SQL Server 2008, or in Microsoft SQL Server 2012.
Symptoms
Assume that you use the management data warehouse feature in SQL Server. By default, system databases are included in Query Statistics collection sets. In this situation, you may exhaust the disk space in a high-throughput environment. Specifically, the following two tables that store the query text and plan may grow very large:
For example, you can run the following Transact-SQL scripts to exclude system databases:
- snapshots.notable_query_text
- snapshots.notable_query_plan
Note By default, the value of IncludeSystemDatabases is set to True.
<ns:QueryActivityCollector xmlns:ns="DataCollectorType">
<Databases IncludeSystemDatabases="True" />
</ns:QueryActivityCollector>
For example, you can run the following Transact-SQL scripts to exclude system databases:
USE MSDB
GO
DECLARE @collection_item_name NVARCHAR(128);
DECLARE @parameters xml;
DECLARE @collection_set_uid uniqueidentifier;
DECLARE @collection_set_id int;
DECLARE @collection_item_id int;
SET @collection_set_uid = N'2DC02BD6-E230-4C05-8516-4E8C0EF21F95';
SET @collection_item_name = 'Query Statistics - Query Activity';
SELECT @collection_set_id = collection_set_id
FROM syscollector_collection_sets
WHERE collection_set_uid = @collection_set_uid;
SET @collection_item_id = NULL;
SELECT @collection_item_id = collection_item_id
FROM syscollector_collection_items_internal
WHERE collection_set_id = @collection_set_id
AND (name = @collection_item_name OR name = @collection_item_name);
SELECT @parameters = convert(xml, N'<ns:QueryActivityCollector xmlns:ns="DataCollectorType">
<Databases IncludeSystemDatabases="false" />
</ns:QueryActivityCollector>');
EXEC dbo.sp_syscollector_update_collection_item
@collection_item_id = @collection_item_id,
@parameters = @parameters;
Resolution
Cumulative update information
Cumulative Update 4 for SQL Server 2012 SP2
Cumulative Update 13 for SQL Server 2012 SP1
Cumulative Update 12 for SQL Server 2008 Service Pack 3
The fix for this issue was first released in Cumulative Update 12. For more information about how to obtain this cumulative update package for SQL Server 2008 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:2863205 Cumulative update package 12 for SQL Server 2008 Service Pack 3
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 Service Pack 3 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:2629969 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 3 was released
Cumulative update 7 for SQL Server 2008 R2 Service Pack 2 (SP2)
The fix for this issue was first released in Cumulative Update 7. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 Service Pack 2, click the following article number to view the article in the Microsoft Knowledge Base:2844090 Cumulative update package 7 for SQL Server 2008 R2 Service Pack 2
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 Service Pack 2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:2730301 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 2 was released
Cumulative Update 10 for SQL Server 2008 Service Pack 3
The fix for this issue was first released in Cumulative Update 10. For more information about how to obtain this cumulative update package for SQL Server 2008 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:2814783 Cumulative update package 10 for SQL Server 2008 Service Pack 3
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 Service Pack 3 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:2629969 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 3 was released
Cumulative Update 5 for SQL Server 2008 R2 SP2
The fix for this issue was first released in Cumulative Update 5. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 SP 2, click the following article number to view the article in the Microsoft Knowledge Base:2797460 Cumulative update package 5 for SQL Server 2008 R2 Service Pack 2
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 SP 2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:2730301 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 2 was released
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
References
For more information about the management data warehouse, go to the following MSDN website: