|
| 1 | +--- |
| 2 | +title: Troubleshoot Repeated SQL Agent Service Failures |
| 3 | +description: Learn how to troubleshoot and resolve repeated crashes of the SQL 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 services crashes intermittently |
| 10 | + |
| 11 | +This article provides troubleshooting guidance for an issue where the SQL Agent service repeatedly crashes on a regular interval. |
| 12 | + |
| 13 | +## Symptoms |
| 14 | + |
| 15 | +The SQL Agent service crashes intermittently on a SQL Server Always On Cluster. When the SQL Agent service crashes the following error message is added to the ???? log: <!-- Ask SME where the error message is reported. Popup, command output, log entry? --> |
| 16 | + |
| 17 | +> [510] SQLAgent failed, dump generated in \<SQL_Instance_Log_Directory\> |
| 18 | +> [LOG] Exception 29539 caught at line 233 of file sql\mpu\SqlAgent\src\autostrt.cpp. SQLServerAgent initiating self-termination. |
| 19 | +
|
| 20 | +## Cause |
| 21 | + |
| 22 | +These crashes occur when the SQL Agent service fails to retrieve the following registry key: |
| 23 | + |
| 24 | +`HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<InstanceID>\SQLServerAgent\AutoRegistryRefresh` |
| 25 | + |
| 26 | +When the registry key retrieve fails, the SQL Agent service reports an exception in the log then terminates itself. |
| 27 | + |
| 28 | +Registry key retrieval can fail due to the following: |
| 29 | + |
| 30 | +- Antivirus or endpoint protection software interfering with registry access. |
| 31 | +- Missing or misconfigured registry keys. |
| 32 | +- Transient access failures in Windows registry. |
| 33 | + |
| 34 | +## Solution |
| 35 | + |
| 36 | +Use the following steps to resolve this issue: |
| 37 | + |
| 38 | +### Step 1: Verify the registry key |
| 39 | + |
| 40 | +1. Open the Registry Editor (`regedit.exe`). |
| 41 | +1. Navigate to the following path: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<InstanceID>\SQLServerAgent`. |
| 42 | +1. Check if the `AutoRegistryRefresh` key exists. |
| 43 | +1. If the `AutoRegistryRefresh` key is missing, create a new _DWORD (32-bit) Value_ named `AutoRegistryRefresh` and set its value to `1` |
| 44 | + |
| 45 | +### Step 2: Exclude SQL Server from antivirus scanning |
| 46 | + |
| 47 | +> [!IMPORTANT] |
| 48 | +> The process of adding an exclusion to your antivirus or endpoint protection software will vary by publisher. Check with the publisher of your software for specific instructions. |
| 49 | +
|
| 50 | +1. Configure your antivirus or endpoint protection software to exclude the common SQL Server processes: |
| 51 | + 1. `sqlservr.exe` |
| 52 | + 1. `sqlagent.exe` |
| 53 | + 1. `ReportingServicesService.exe` |
| 54 | + 1. `msmdsrv.exe` |
| 55 | + 1. `fdlauncher.exe` |
| 56 | + 1. `fdhost.exe` |
| 57 | +1. Also, exclude the directory where SQL Server is installed, for example `C:\Program Files\Microsoft SQL Server\` |
| 58 | + |
| 59 | +For more info on configuring your antivirus or endpoint protection software to work with SQL Server, see [Configure antivirus software to work with SQL Server](/troubleshoot/sql/database-engine/security/antivirus-and-sql-server). |
| 60 | + |
| 61 | +### Step 3: Check event logs and dumps |
| 62 | + |
| 63 | +<!-- Check with SME what the user is looking for when they review these logs and dumps --> |
| 64 | + |
| 65 | +1. Review the SQL Agent logs located in: `<SQL_Instance_Log_Directory>\SQLAGENT.OUT\`. |
| 66 | +1. Review the Application and System logs in Event Viewer for related errors. |
| 67 | +1. Analyze the SQL Agent dump file (if multiple dumps are generated, focus on the most recent one). |
| 68 | + |
| 69 | +### Step 4: Restart SQL Agent service |
| 70 | + |
| 71 | +Restart the SQL Agent service for the previous changes to take effect. |
| 72 | + |
| 73 | +### Step 5: Monitor stability |
| 74 | + |
| 75 | +1. Monitor the SQL Agent logs for recurrence of the error. |
| 76 | +1. Confirm that no new dumps are generated in the log folder. |
0 commit comments