Wednesday, 2 September 2009

syspolicy_purge_history failed on the cluster

This one is apparently a bug. It's a job that SQL creates when it installs SQL 2008, and it will perpetually error on the "Erase Phantom System Health Records" step, owing to the fact that it will insist on calling the method on the node name, rather than on the virtual servername

viz

"MessageExecuted as user: Domain\AgentServiceAccount. A job step received an error at line 1 in a PowerShell script. The corresponding line is '(Get-Item SQLSERVER:\SQLPolicy\SQLClusterInstanceNameNodeName\Default).EraseSystemHealthPhantomRecords()'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Method invocation failed because [Microsoft.SqlServer.Management.PowerShell.Extensions.Machine] doesn't contain a method named 'EraseSystemHealthPhantomRecords'. '. Process Exit Code -1. The step failed."

The way to deal with it is to change the script a bit:

"Get-Item SQLSERVER:\SQLPolicy\VirtualServerName\InstanceName".

And, if it's the default instance, or there is only one SQL instance on the cluster, go for

Get-Item SQLSERVER:\SQLPolicy\SQLClusterInstanceName\default"

In other words, just get rid of the Node information, and all will be fine

KB article.

Not that I have quite worked out what this job does: keeps things tidy if you have policy management set up, I imagine. Which is useful.

2 comments:

  1. Thanks for this, solved a forever failing job issue in my new DBA role!

    ReplyDelete
  2. Nice, this fixed my problem!

    ReplyDelete