Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Microsoft 將 Microsoft SQL Server 2008 R2 SP1 發佈為一個可下載的檔案。 因為修正程式是累加的,所以每個新發行版本本都包含先前 SQL Server 2008 R2 SP1 修正版本中所包含的所有修復程式及所有安全修正程式。

徵狀

請試想下列案例:

  • 管理資料倉儲(MDW)資料庫有一個 snapshots.query_stats 資料表,其中包含大量資料在 Microsoft sql server 2008 或 Microsoft sql Server 2008 R2 中。

  • 您可以執行下列資料收集收集作業,以清除 MDW 資料庫中的資料。

    mdw_purge_data_ [<mdw 資料庫名稱>]

在這種情況下,需要花很長的時間,才能讓資料收集器工作清除資料。 注意事項

原因

發生這個問題的原因是,如果snapshots.query_stats資料表包含大量的資料, mdw_purge_data工作需要花很長的時間執行以批進行的清除操作。

解決方案

Service pack 資訊

SQL Server 2008若要在 SQL Server 2008 中解決這個問題,請遵循下列步驟:

  1. 取得最新的 SQL Server 2008 service pack。如需詳細資訊,請按一下下列文章編號,以查看 Microsoft 知識庫中的文章:

    968382 如何取得最新的 SQL Server service pack 2008

  2. 若是現有的 MDW 資料庫,您必須在安裝 SQL Server 2008 的最新 service pack 之後,再執行 [設定管理資料倉儲] 嚮導進行更新。

SQL Server 2008 R2若要在 SQL Server 2008 R2 中解決這個問題,請遵循下列步驟:

  1. 取得最新的 SQL Server 2008 R2 service pack。如需詳細資訊,請按一下下列文章編號,以查看 Microsoft 知識庫中的文章:

    2527041 如何取得最新的 SQL Server 2008 R2 service pack

  2. 若是現有的 MDW 資料庫,您必須在安裝最新 service pack for SQL Server 2008 R2 之後,再執行 [設定管理資料倉儲] 嚮導進行更新。

  3. 更新 sp_purge_orphaned_notable_query_text 的存儲程式,如下所示:現有程式

    -- 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 tmpWHERE tmp.[sql_handle] = qp.[sql_handle]

    更新程式

    -- 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 tmpWHERE tmp.[sql_handle] = qt.[sql_handle]

    注意: 在套用 SQL Server 2008 R2 Service Pack 1 之後,因為 delete 語句不正確參照 snapshots.notable_query_plan 資料表,所以需要這些變更來修正 sp_purge_orphaned_notable_query_text 的已儲存程式的文字。

狀態

Microsoft 已確認本篇文章<適用於>一節所列之 Microsoft 產品確實有上述問題。

您也可以在下列博客中找到更新資料收集器儲存程式的完整腳本:

http://blogs.msdn.com/b/sqlagent/archive/2011/04/12/data-collector-s-sp-purge-data-may-run-for-hours-if-there-are-many-orphaned-plans-to-purge.aspx

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×