Share via


sp_syspolicy_purge_health_state (Transact-SQL)

在以原則為基礎的管理中刪除原則健全狀態。原則健全狀態是 [物件總管] 內的視覺化指標 (具有紅色 "X" 的捲動符號),可讓您判斷哪些節點的原則評估失敗。

主題連結圖示Transact-SQL 語法慣例

語法

sp_syspolicy_purge_health_state [ @target_tree_root_with_id = ] 'target_tree_root_with_id'

引數

  • [ @target_tree_root_with_id = ] 'target_tree_root_with_id'
    表示您想要在 [物件總管] 中清除健全狀態的節點。target_tree_root_with_id 是 nvarchar(400),且預設值為 NULL。

    您可以從 msdb.dbo.syspolicy_system_health_state 系統檢視表的 target_query_expression_with_id 資料行指定值。

傳回碼值

0 (成功) 或 1 (失敗)

備註

您必須在 msdb 系統資料庫的內容中執行 sp_syspolicy_purge_health_state。

如果您執行這個預存程序而不使用任何參數,將會在 [物件總管] 內刪除所有節點的系統健全狀態。

權限

需要 PolicyAdministratorRole 固定資料庫角色中的成員資格。

安全性注意事項安全性注意事項

可能會提高認證:PolicyAdministratorRole 角色中的使用者可以建立伺服器觸發程序以及排程可能會影響 Database Engine 執行個體作業的原則執行。例如,PolicyAdministratorRole 角色中的使用者可以建立防止在 Database Engine 中建立大部分物件的原則。由於可能會提高認證,因此 PolicyAdministratorRole 角色應該只授與可控制 Database Engine 組態的受信任使用者。

範例

下列範例會在 [物件總管] 內刪除特定節點的健全狀態。

EXEC msdb.dbo.sp_syspolicy_purge_health_state @target_tree_root_with_id = 'Server/Database[@ID=7]';

GO