sp_syspolicy_purge_health_state (Transact-SQL)

适用于:SQL Server

在基于策略的管理中删除策略运行状态。 策略运行状况状态是对象资源管理器(带有红色“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_idnvarchar(400),默认值为 NULL.

可以从系统视图的target_query_expression_with_id列中 msdb.dbo.syspolicy_system_health_state 指定值。

返回代码值

0(成功)或 1(失败)。

注解

必须在系统数据库的上下文msdb中运行sp_syspolicy_purge_health_state

如果您运行此存储过程且未带任何参数,则对象资源管理器中所有节点的系统运行状态都将被删除。

权限

需要 Policy管理员istratorRole 固定数据库角色的成员身份。

重要

可能的凭据提升:Policy管理员istratorRole 角色中的用户可以创建服务器触发器并计划可能影响数据库引擎实例操作的策略执行。 例如,Policy管理员istratorRole 角色中的用户可以创建一个策略,以防止在数据库引擎中创建大多数对象。 由于这种可能的凭据提升,策略管理员istratorRole 角色应仅授予信任控制数据库引擎配置的用户。

示例

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

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