Microsoft distributes Microsoft SQL Server 2008 R2 SP1 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 SP1 fix release.
Consider the following scenario:
In this scenario, it takes a long time for the Data Collector job to clear data.
Notes- The Data Collector job calls the core.sp_purge_data stored procedure to clear data.
- For more information about this issue in SQL Server 2008 R2, visit the following Microsoft website:
This issue occurs because the
mdw_purge_data job takes a long time to perform a batch-oriented clear operation if the
snapshots.query_stats table contains a large amount of data.
Service pack information
SQL Server 2008To resolve this issue in SQL Server 2008, follow these steps:
- Obtain the latest service pack for SQL Server 2008.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:968382
(http://support.microsoft.com/kb/968382/
)
How to obtain the latest service pack for SQL Server 2008
- For an existing MDW database, you must update it by running the Configure Management Data Warehouse Wizard after you install the latest service pack for SQL Server 2008.
SQL Server 2008 R2To resolve this issue in SQL Server 2008 R2, follow these steps:
- Obtain the latest service pack for SQL Server 2008 R2.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2527041
(http://support.microsoft.com/kb/2527041/
)
How to obtain the latest service pack for SQL Server 2008 R2
- For an existing MDW database, you must update it by running the Configure Management Data Warehouse Wizard after you install the latest service pack for SQL Server 2008 R2
- Update the sp_purge_orphaned_notable_query_text stored procedure as follows:
Existing procedure
-- Deleting TOP N orphaned rows in query plan table by joining info from temp table variable
-- This is done to speed up delete query.
DELETE TOP (@delete_batch_size) snapshots.notable_query_plan
FROM snapshots.notable_query_plan AS qp , #tmp_notable_query_plan AS tmp
WHERE tmp.[sql_handle] = qp.[sql_handle]
Updated procedure
-- Deleting TOP N orphaned rows in query text table by joining info from temp table
-- This is done to speed up delete query.
DELETE TOP (@delete_batch_size) snapshots.notable_query_text
FROM snapshots.notable_query_text AS qt, #tmp_notable_query_text AS tmp
WHERE tmp.[sql_handle] = qt.[sql_handle]
Note These changes are required to correct the text of the sp_purge_orphaned_notable_query_text stored procedure because the delete statement incorrectly references the snapshots.notable_query_plan table after you apply SQL Server 2008 R2 Service Pack 1.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
The complete script to update the data collector stored procedure can also be found in the following blog:
Article ID: 2584903 - Last Review: June 5, 2012 - Revision: 5.0
APPLIES TO
- Microsoft SQL Server 2008 Standard
- Microsoft SQL Server 2008 Developer
- Microsoft SQL Server 2008 Enterprise
- Microsoft SQL Server 2008 R2 Datacenter
- Microsoft SQL Server 2008 R2 Developer
- Microsoft SQL Server 2008 R2 Enterprise
- Microsoft SQL Server 2008 R2 Standard
| kbqfe kbexpertiseadvanced kbsurveynew kbfix KB2584903 |