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 角色的用户可以创建服务器触发器并计划策略执行,这可能会影响数据库引擎实例的正常运行。例如,PolicyAdministratorRole 角色中的用户可以创建一个策略,它可能会禁止在数据库引擎中创建大多数对象。由于这种可能的凭据提升,只应将 PolicyAdministratorRole 角色授予可信任其控制数据库引擎配置的用户。

示例

下面的示例将删除对象资源管理器中特定节点的运行状态。

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

GO