Erase phantom system health records ошибка

RRS feed

  • Remove From My Forums
  • Question

  • Hi ,

    I am using SQL server 2014, Jobs is successfully executing for more than a year. For few days step#3 «Erase Phantom System Health Records» gives following error:

    «Executed as user: User_name. The step did not generate any output. Process Exit Code 255. The step failed.»

    I am unable to find exact solution.

    Thanks for help.

Answers

  • Hi Cathy,

    We just restarted the server and issue resolved.

    Thanks

    • Marked as answer by
      ZahidButt
      Thursday, February 20, 2020 5:17 PM

All replies

  • Hi Cathy,

    I found an error in event viewer:

    «Faulting application name: SQLPS.exe, version: 12.0.2000.8, time stamp: 0x5306bda0
    Faulting module name: KERNELBASE.dll, version: 6.3.9600.19478, time stamp: 0x5d6aa558
    Exception code: 0xc0000142″

    I think this is the culprit. If it is so then what is the solution ?

    I found following 2 links explaining solution:

    https://answers.microsoft.com/en-us/windows/forum/windows_10-performance/error-0xc0000142/3da27a75-178c-4de5-b43c-c538e6005540

    How to Fix Windows 10 Error Code 0xc0000142

    Thanks

    • Edited by
      ZahidButt
      Tuesday, February 11, 2020 2:37 PM

  • Hi ZahidButt,

    Any other more error information? Did you try to apply
    SP3 for SQL server 2014 and
    CU4 for SQL 2014 SP3?

    Best regards,
    Cathy 


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
     MSDN Support, feel free to contact MSDNFSF@microsoft.com

  • Hi Cathy,

    We just restarted the server and issue resolved.

    Thanks

    • Marked as answer by
      ZahidButt
      Thursday, February 20, 2020 5:17 PM

  • Remove From My Forums
  • Question

  • I recently installed SQL Server 2012 Ent (x64). The install is a stand alone default instance.

    The syspolicy_purge_history job fails on step three with the following error:

    Executed as user: <DomainName>sql_xxx_agt_svc. A job step received an error at line 1 in a PowerShell script. The corresponding line is ‘set-executionpolicy RemoteSigned -scope process -Force’. Correct the script and reschedule the job. The error
    information returned by PowerShell is: ‘Security error.  ‘.  Process Exit Code -1.  The step failed.

    Here is the code that is in the step:

    if (‘$(ESCAPE_SQUOTE(INST))’ -eq ‘MSSQLSERVER’) {$a = ‘DEFAULT’} ELSE {$a = »};
    (Get-Item SQLSERVER:SQLPolicy$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()

    The domain user is the account that SQL Agent is running as.

    What permissions need to be granted to this account?

    Here is the link to the Connect post:

    https://connect.microsoft.com/SQLServer/feedback/details/754063/sql-server-2012-syspolicy-purge-history-job-step-3-fails-with-security-error

    • Edited by

      Tuesday, December 4, 2012 5:53 PM

Answers

  • SQL Server 2012 Service Pack 2 has fixed the problem.

    I have set the 2 reg keys back to their original values:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShellExecutionPolicy = Restricted
    HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.SqlServer.Management.PowerShell.sqlps110ExecutionPolicy = RemoteSigned

    The job now completes.

    • Marked as answer by
      William Soranno
      Tuesday, July 26, 2016 1:45 PM

Question: In SQL Server 2008 there is a SQL Server Agent Job called syspolicy_purge_history . Step 3 — Erase Phantom System Health Records is failing with reason 193. I have a daily Powershell script — List failed SQL server Jobs with Powershell which reports the failure

How can I fix?

Answer:Look at the command in the Job Step. It will be something like:

 It’s attempting a mapping to the SQL Server Instance Path. Which is probably something like:

 (Get-Item SQLSERVER:SQLPolicyMyServerInstance).EraseSystemHealthPhantomRecords()

 C:Program Filesxxxxxxx

 Look at the C: , is there a file called “Program” ? Not a directory , but a file. If so , rename it and rerun the job. It should fix the error .

If this solution does not fix the reason 193 issue on Erase Phantom System Health Records, contact me and I’ll help you out

Related Posts

How to request SQL Server troubleshooting

SQL Server Agent Job Steps

List failed SQL server Jobs with Powershell

Author: Tom Collins (http://www.sqlserver-dba.com)

Share:

Verify your Comment

Previewing your Comment

Posted by:
|

This is only a preview. Your comment has not yet been posted.

Working...

Your comment could not be posted. Error type:

Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to Erase Phantom System Health Records – reason 193

The SQL
Agent Job «syspolicy_purge_history»
was failing in our environment since we have upgraded our SQL server
instance from SQL 2008R2 to SQL2012. The job was failing at step-3 named as
«Erase Phantom System Health Records» We have tried each and every
article available over internet, but nothing was helpful in our case. After a
lot of troubleshooting my friend Desh found the solution for it. 

There
are still lot of DBA’s searching the fix of same issue. So, I want to share the
all steps which fixed the issue. You can try it in your case
and let us know if this works.

Issue
Details:

SQL
Server version:
SQL Server 2012

Job
Name:
syspolicy_purge_history

Error:

Executed as user: «XXXXX». The job script encountered the following errors. 
These errors did not stop the script:  A job step received an error at line 1 in a PowerShell script. The corresponding line is ‘import-module SQLPS  -DisableNameChecking’. Correct the script and reschedule the job. The error information returned by PowerShell is: ‘The specified module ‘SQLPS’ was not loaded because no valid module file was found in any module directory.  ‘  A job step received an error at line 2 in a PowerShell script. The corresponding line is ‘(Get-Item SQLSERVER:SQLPolicyServerName$a).EraseSystemHealthPhantomRecords()’. Correct the script and reschedule the job. The error information returned by PowerShell is: ‘Cannot find drive. A drive with the name ‘SQLSERVER’ does not exist.  ‘  A job step received an error at line 2 in a PowerShell script. The corresponding line is ‘(Get-Item SQLSERVER:SQLPolicy

Steps
to Fix the issue:

The first step is to check if SQLPS folder exists to below
location:

C:Program
FilesMicrosoft SQL Server110ToolsPowerShellModules

Now Open Computer Properties
and then click on advance system settings> environment variables> Copy
the environment path to a notepad file

%ProgramFiles%WindowsPowerShellModules;

%SystemRoot%system32WindowsPowerShellv1.0Modules

Now copy the SQLPS
folder from location “C:Program FilesMicrosoft SQL
Server110ToolsPowerShellModules“ to below locations which we found under
environment variables:

 %ProgramFiles%WindowsPowerShellModules

                                           %SystemRoot%system32WindowsPowerShellv1.0Modules

You can Open the above two locations via start>run>
and then paste location and then Enter.

Once this folder is copied to these locations. Try to run the
below command from Powershell.

Open Powershell  as
admin and then execute the below command.

import-module
SQLPS  -DisableNameChecking

Once
import module is done. 
Open the Group Policy Object Editor as below:

  1.  Start > run > «mmc»
  2.  File > Add/Remove Snap-In…
  3.  Under Available snap-ins, select «Group Policy Object Editor» and click Add, then Finish.
  4.  Click OK to snap-in the GPO Editor

Now navigate to the specific policy:

  1.  Console Root > Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Windows Powershell
  2.  Open-up the «Turn on Script Execution» policy setting
  3.  Enable Script Execution and in Options select “ Allow All Scripts”. Apply the setting and click on OK.
  4.  Exit from this window

Below
is the screen shot for above steps for your reference:

Exit from this window and during save pop-up dialog click on
No.

Now Try to run the Job it should be running without any issue.

Hope this works in your case.

I have a SQL Server named instance that runs the standard syspolicy_purge_history job every night. The job is marked as succeeding every night, but every night on the DEFAULT instance on the same server, there is a failed login connection from the service account of the named instance.

I’ve tracked it down to the Erase Phantom System Health Records step of the syspolicy_purge_history job. The job uses the standard code and does not appear to have been modified in any way:

if ('$(ESCAPE_SQUOTE(INST))' -eq 'MSSQLSERVER') {$a = 'DEFAULT'} ELSE {$a = ''};
(Get-Item SQLSERVER:SQLPolicy$(ESCAPE_NONE(SRVR))$a).EraseSystemHealthPhantomRecords()

There are two other named instances on the same server, running the same job with the same code, and they do not generate failed login errors on the default instance.

I tried deleting the job, and recreating it by scripting the job from one of the other named instances. It made no difference.

I tried changing the code of step 3 to:

(Get-Item SQLSERVER:SQLPolicy[MyServerName][NamedInstanceName]).EraseSystemHealthPhantomRecords()

and alternatively to:

(Get-Item SQLSERVER:SQLPolicy[MyServerName][NamedInstanceName]`,[NamedInstancePort]).EraseSystemHealthPhantomRecords()

Both versions still generate the failed login on the default instance.

Both versions of the command appear to work successfully if I run them from a powershell window, and do NOT generate a failed login.

I cannot think of anything else to try. Google seems to be out of suggestions for me too.

Any ideas?

Понравилась статья? Поделить с друзьями:
  • Er66 трибека ошибка субару
  • Error occurred on gpuid 100 ошибка
  • Error occurred during initialization of boot layer ошибка
  • Error model bind samsung smart как исправить ошибку
  • Error load settings как исправить ошибку при запуске