syspolicy_purge_history job failing

  • Hi,

    We are using SQL server 2008R2 standard edition with 2 node active passive failover clustering.

    The job is started failing after the failover.

    Unable to start execution of step 3 (reason: The PowerShell subsystem failed to load [see the SQLAGENT.OUT file for details]; The job has been suspended). The step failed.

    The binaries in both nodes are different paths. I copied the whole folder from node2 to node1 and try to run the job @step but it didn't start.

    Do we need to restart the agent after copying the path from Node2 to Node1?

    Is it best practice to do?

    Even if we update the job might fail again after the failover

  • Let me start by saying I don't know PowerShell.

    The jobs are defined in msdb, which is some sort of shared storage. When you fail over, the active node picks up the msdb definitions of the jobs. If the job says to run step X by executing a PowerShell script stored somewhere on disk, that script file had better exist on disk or the job will fail.

    Your script, therefore, will need to exist in the same physical path on node 1 and node 2 or the job won't work be able to work in both nodes. It could be on the shared storage or the local storage, but the path and filename need to be the same so the same command will work on either node.

  • Please check this out: https://support.microsoft.com/en-us/kb/955726

    This helped me some time ago.

    Cause:

    This problem may occur if the syspolicy_purge_history job uses the computer node name instead of the virtual server name for the cluster instance.

    There are two options provided by Microsoft. Please check out the article.

    See an old related post on this issue: http://www.sqlservercentral.com/Forums/Topic772839-146-1.aspx

    -Regards,

  • I followed the step2 from MS but though it is failing.

    Do we need to restart agent for any method?

    I followed the same

    https://www.mssqltips.com/sqlservertip/2041/why-syspolicypurgehistory-job-fails-in-sql-server-2008-failover-cluster-instance/

    But didn't find helpful. Still failing with the same error

  • Can you tell us anything else other than the fact that it failed?

    Is PowerShell available on both servers?

    Is the instance name correct in the PowerShell command?

    Is the SQL Agent service running on the active node?

    Have you looked at the SQL Agent service account?

    You didn't give us an error message. Did you get one?

  • Yes powershell is running on Node1 and Node2

    SQL Agent is running because the remaining jobs are running fine.

    Error: Unable to start execution of step 3 (reason: The PowerShell subsystem failed to load [see the SQLAGENT.OUT file for details]; The job has been suspended). The step failed.

    From SQL Agent.out Request to run job syspolicy_purge_history (from User ) refused because the job has been suspended

    The step has the below code

    if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = '\DEFAULT'} ELSE {$a = ''};

    (Get-Item SQLSERVER:\SQLPolicy\SQLVirtualname\SQLInstancename).EraseSystemHealthPhantomRecords()

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply