Troubleshooting Policy-Based Management Policies

Policy-Based Management records errors to both the Windows event log and, for scheduled policies, the SQL Server Agent log. If policies are not enabled or do not effect the expected target, the failure is not considered an error and is not logged.

SELECT * FROM sys.server_event_notifications
WHERE name = N'syspolicy_event_notification' ;
GO

Check the evaluation engine.

Check the Windows event log for a Policy-Based Management error.

An On Schedule Policy Is Not Executing

An On Schedule policy can fail for the same reasons as an On change: log or On change: prevent policy, and also because there was a failure in the SQL Server Agent job. For more information about jobs, see Viewing and Modifying Jobs.

Policy-Based Management does not provide specific tools to diagnose performance related problems. To determine the execution time for policies, query the start_date and end_date columns in the msdb.dbo.syspolicy_policy_execution_history view.

This section describes how error handling and logging work for several policies.

On Change: Log Policy and On Change: Prevent Policy

Policy execution errors are logged to the Windows event log. The log will have the Policy-Based Management error text and an XML description that contains the details of the SQL Server event. Exceptions on the main execution logic are Policy execution errors are displayed in the msdb.dbo.syspolicy_policy_execution_history and msdb.dbo.syspolicy_policy_execution_history_details views.

On Schedule Policy

Because an On schedule policy involves SQL Server Agent, the Agent log files are the first location to look. Check whether the job has successfully completed. The SQL Server Agent log will contain failures of stored procedure calls. If the job completed successfully, check the Windows event log for policy execution failures.