Saturday, July 9, 2016

Troubleshoot syspolicy_purge_history job failure

Step 3: Erase Phantom System Health Records fails

Message:

Executed as user: Domain\ServiceAccount. A job step received an error at line 1 in a PowerShell script. The corresponding line is '(Get-Item SQLSERVER:\SQLPolicy\NodeA\SQL82).EraseSystemHealthPhantomRecords()'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Failed to connect to server .  A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)  '.  Process Exit Code -1.  The step failed.

Solution: Usually it fails on cluster server, due to its pointing to Node name instead of cluster name.

Please replace NodeA with virtual SQL Server name and rerun the job.