|
| 1 | +--- |
| 2 | +title: Troubleshoot Repeated SQL Server Agent Service Failures |
| 3 | +description: Resolve repeated failures of the SQL Server Agent service. Follow step-by-step solutions to fix registry issues and improve stability. |
| 4 | +ms.date: 12/04/2025 |
| 5 | +ms.custom: sap:SQL Agent (Jobs, Alerts, Operators)\SQL Agent Service is unable to start, stops or restarts unexpectedly |
| 6 | +ms.reviewer: prmadhes, v-shaywood |
| 7 | +--- |
| 8 | + |
| 9 | +# SQL Agent service fails intermittently |
| 10 | + |
| 11 | +This article provides troubleshooting guidance for an issue where the SQL Agent service repeatedly stops responding at regular intervals. |
| 12 | + |
| 13 | +## Symptoms |
| 14 | + |
| 15 | +The SQL Server Agent service fails intermittently on a SQL Server Always On Cluster. When the service fails, the following error message is added to the SQL Server Agent log: |
| 16 | + |
| 17 | +```log |
| 18 | +[510] SQLAgent failed, dump generated in \<SQL_Instance_Log_Directory\> |
| 19 | +[LOG] Exception 29539 caught at line 233 of file sql\mpu\SqlAgent\src\autostrt.cpp. SQLServerAgent initiating self-termination. |
| 20 | +``` |
| 21 | + |
| 22 | +## Cause |
| 23 | + |
| 24 | +These failures occur if the SQL Server Agent service doesn't retrieve the following registry subkey: |
| 25 | + |
| 26 | +`HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<InstanceID>\SQLServerAgent\AutoRegistryRefresh` |
| 27 | + |
| 28 | +When the registry subkey retrieval fails, the SQL Server Agent service reports an exception in the log, and then it terminates itself. |
| 29 | + |
| 30 | +Registry subkey retrieval can fail because of the following reasons: |
| 31 | + |
| 32 | +- Antivirus or endpoint protection software that interferes with registry access |
| 33 | +- Missing or misconfigured registry keys |
| 34 | +- Transient access failures in Windows registry |
| 35 | + |
| 36 | +## Solution |
| 37 | + |
| 38 | +To resolve this issue, follow these steps. |
| 39 | + |
| 40 | +### Step 1: Verify the registry key |
| 41 | + |
| 42 | +1. Start Registry Editor (`regedit.exe`). |
| 43 | +1. Go to the following path: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<InstanceID>\SQLServerAgent`. |
| 44 | +1. Check whether the `AutoRegistryRefresh` key exists. |
| 45 | +1. If the `AutoRegistryRefresh` key is missing, create a _DWORD (32-bit) Value_ that's named `AutoRegistryRefresh`, and set its value to `1`. |
| 46 | + |
| 47 | +### Step 2: Exclude SQL Server from antivirus scanning |
| 48 | + |
| 49 | +> [!IMPORTANT] |
| 50 | +> The process of adding an exclusion to your antivirus or endpoint protection software varies by publisher. Check with the publisher of your software for specific instructions. |
| 51 | +
|
| 52 | +1. Configure your antivirus or endpoint protection software to exclude the common SQL Server processes: |
| 53 | + - `sqlservr.exe` |
| 54 | + - `sqlagent.exe` |
| 55 | + - `ReportingServicesService.exe` |
| 56 | + - `msmdsrv.exe` |
| 57 | + - `fdlauncher.exe` |
| 58 | + - `fdhost.exe` |
| 59 | +1. Also, exclude the folder where SQL Server is installed. For example, `C:\Program Files\Microsoft SQL Server\`. |
| 60 | + |
| 61 | +For more information about how to configure your antivirus or endpoint protection software to work together with SQL Server, see [Configure antivirus software to work with SQL Server](/troubleshoot/sql/database-engine/security/antivirus-and-sql-server). |
| 62 | + |
| 63 | +### Step 3: Check event logs and dump files |
| 64 | + |
| 65 | +Check whether the logs or the most recent SQL Agent dump file contain any new errors: |
| 66 | + |
| 67 | +1. Review the SQL Server Agent logs that are located in: `<SQL_Instance_Log_Directory>\SQLAGENT.OUT\`. |
| 68 | +1. Review the Application and system logs in Event Viewer for related errors. |
| 69 | +1. Analyze the SQL Agent dump file. If multiple dump files are generated, focus on the most recent one. |
| 70 | + |
| 71 | +If no new errors are reported, go to the next step. If new errors exist, repeat the previous steps, and then check the event logs and dump files again. |
| 72 | + |
| 73 | +### Step 4: Restart SQL Server Agent service |
| 74 | + |
| 75 | +Restart the SQL Server Agent service in order for the changes to take full effect. |
| 76 | + |
| 77 | +### Step 5: Monitor stability |
| 78 | + |
| 79 | +1. Monitor the SQL Server Agent logs for any recurrence of the error. |
| 80 | +1. Verify that no new dump files are generated in the log folder. |
0 commit comments