Troubleshooting SYSPOLICY_PURGE_HISTORY Job Failure in Stand Alone Instance of SQL Server 2008


Jun 05, 2012

Introduction

This article describes troubleshooting steps for SYSPOLICY_PURGE_HISTORY SQL Server Job failure in Stand-Alone Instance of SQL Server 2008. In case of SYSPOLICY_PURGE_HISTORY  Job has failed in a Failover Instance of SQL Server 2008 then refer the following article titled "Troubleshooting SYSPOLICY_PURGE_HISTORY Job Failure in Failover Cluster Instance of SQL Server 2008"

SYSPOLICY_PURGE_HISTORY job fails when you rename a computer that hosts a Stand-Alone Instance of SQL Server

The SYSPOLICY_PURGE_HISTORY Job fails with the below mentioned error at step 3 “Erase Phantom System Health Records” once you have renamed a computer that hosts a stand-alone instance of SQL Server. The reason why this job is falling at Step 3 “Erase Phantom System Health Records” is within the PowerShell script still the Old SQL Server Name is mentioned. To resolve this issue you need to replace the Old SQL Server Name with the New SQL Server Name.

Error Message

Executed as user: Domain\UserName. A job step received an error at line 1 in a PowerShell script. The corresponding line is '(Get-Item SQLSERVER:\SQLPolicy\OLDSQLServerName\DEFAULT).EraseSystemHealthPhantomRecords()'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot retrieve the dynamic parameters for the cmdlet. SQL Server PowerShell provider error: Could not connect to 'OLDSQLServerName\DEFAULT'.

Wrong Server Name in Erase Phantom System Health Records job step

(Get-Item SQLSERVER:\SQLPolicy\OldStandAloneSQLServerName\DEFAULT).EraseSystemHealthPhantomRecords()

Resolution

Correct Server Name in Erase Phantom System Health Records job step

(Get-Item SQLSERVER:\SQLPolicy\NewStandAloneSQLServerName\DEFAULT).EraseSystemHealthPhantomRecords()

You need to make the changes to the PowerShell script and then click OK to save the change to SYSPOLICY_PURGE_HISTORY Job as shown in the snippet below.

SYSPOLICY_PURGE_HISTORY Failure on Stand-Alone SQL Server 2008 Instance

Conclusion

In this article you have seen troubleshooting steps for SYSPOLICY_PURGE_HISTORY Job failure in Stand Alone Instance of SQL Server 2008.

Continue Free Learning...

  • Please leave below your valuable feedback for this article.
  • Feel Free to refer this article to your friends and colleagues using the below “Share this Article” option.
  • Do subscriber to our News Letter to continue your free learning.
  • Don’t forget to Like Us on Facebook and do follow us on Twitter for latest updates.

Share this Article


Geeks who read this article also read…



Follow @MyTechMantra on Twitter
We're on Facebook
Bookmark and Share

"Receive newsletters and special offers about SQL Server, BizTalk and SharePoint from MyTechMantra. We respect your privacy and you can unsubscribe at any time."