|
1 | 1 | --- |
2 | | -title: SQL Server agent crashes when you try to start it |
3 | | -description: This article discusses the issues experienced by SQL Server agent service when you create multiple jobs in your SQL Server instance. |
4 | | -ms.date: 11/08/2022 |
5 | | -ms.reviewer: ramakoni1, v-jayaramanp |
| 2 | +title: SQL Server Agent Stops Responding When You Try to Start It |
| 3 | +description: Resolves an issue in which SQL Server Agent doesn't start, and provides troubleshooting guidance for multiple job entries and missing ODBC drivers. |
| 4 | +ms.date: 12/03/2025 |
| 5 | +ms.reviewer: ramakoni1, v-jayaramanp, v-shaywood |
6 | 6 | ms.custom: sap:Startup, shutdown, restart issues (instance or database) |
7 | 7 | --- |
8 | 8 |
|
9 | | -# SQL Server agent crashes when you try to start it |
| 9 | +# SQL Server Agent shuts down unexpectedly when you try to start it |
10 | 10 |
|
11 | | -This article discusses the issues experienced by SQL Server agent service when you create multiple jobs in your SQL Server instance. |
| 11 | +This article provides troubleshooting guidance for an issue in which the SQL Server Agent service stops responding or takes longer than you expect when you try to start it. Many different underlying problems can cause this issue. This article covers some of the most common scenarios. |
12 | 12 |
|
13 | 13 | _Original product version:_ SQL Server \ |
14 | 14 | _Original KB number:_ 2795690 |
15 | 15 |
|
16 | 16 | ## Symptoms |
17 | 17 |
|
18 | | -A SQL Server agent crashes when you try to start it or takes longer than expected to start. Additionally, you may experience one or more of the following scenarios: |
19 | | - |
20 | | -- **Scenario 1**: The following error message is logged in the System event log: |
21 | | - > The service didn't respond to the start or control request in a timely fashion. |
22 | | -- **Scenario 2**: The status of the agent displays as "Starting" in the Control Panel, and the following error message is logged in the *SQLAgent.log* file: |
23 | | - > An idle CPU condition has not been defined - OnIdle job schedules will have no effect. |
24 | | -
|
25 | | - Additionally, the following entries may be logged in the *SQLAgent.log* file: |
26 | | - |
27 | | - ```output |
28 | | - <Time Stamp> - ? [431] Populating subsystems cache... \ |
29 | | - <Time Stamp> - ? [432] There are 7 subsystems in the subsystems cache \ |
30 | | - <Time Stamp> - ? [124] Subsystem 'ActiveScripting' successfully loaded (maximum concurrency: 40)\ |
31 | | - <Time Stamp> - ? [124] Subsystem 'ANALYSISCOMMAND' successfully loaded (maximum concurrency: 400)\ |
32 | | - <Time Stamp> - ? [124] Subsystem 'ANALYSISQUERY' successfully loaded (maximum concurrency: 400)\ |
33 | | - <Time Stamp> - ? [124] Subsystem 'CmdExec' successfully loaded (maximum concurrency: 40)\ |
34 | | - <Time Stamp> - ? [124] Subsystem 'PowerShell' successfully loaded (maximum concurrency: 2)\ |
35 | | - <Time Stamp> - ? [124] Subsystem 'SSIS' successfully loaded (maximum concurrency: 400)\ |
36 | | - <Time Stamp> - ? [124] Subsystem 'TSQL' successfully loaded (maximum concurrency: 80)\ |
37 | | - <Time Stamp> - ! [364] The Messenger service has not been started - NetSend notifications will not be sent\ |
38 | | - <Time Stamp> - ? [129] SQLSERVERAGENT starting under Windows NT service control\ |
39 | | - <Time Stamp> - + [396] An idle CPU condition has not been defined - OnIdle job schedules will have no effect\ |
40 | | - <Time Stamp> - ? [110] Starting SQLServerAgent Monitor using '' as the notification recipient...\ |
41 | | - <Time Stamp> - ? [146] Request servicer engine started\ |
42 | | - <Time Stamp> - ? [133] Support engine started\ |
43 | | - <Time Stamp> - ? [167] Populating job cache...\ |
44 | | - <Time Stamp> - ? [131] SQLSERVERAGENT service stopping due to a stop request from a user, process, or the OS...\ |
45 | | - <Time Stamp> - ? [134] Support engine stopped\ |
46 | | - <Time Stamp> - ? [197] Alert engine stopped\ |
47 | | - <Time Stamp> - ? [168] There are 4731 job(s) [0 disabled] in the job cache\ |
48 | | - <Time Stamp> - ? [170] Populating alert cache...\ |
49 | | - <Time Stamp> - ? [171] There are 0 alert(s) in the alert cache\ |
50 | | - <Time Stamp> - ? [149] Request servicer engine stopped\ |
51 | | - <Time Stamp> - ? [248] Saving NextRunDate/Times for all updated job schedules...\ |
52 | | - <Time Stamp> - ? [249] 0 job schedule(s) saved\ |
53 | | - <Time Stamp> - ? [127] Waiting for subsystems to finish...\ |
54 | | - <Time Stamp> - ? [128] Subsystem 'ActiveScripting' stopped (exit code 1)\ |
55 | | - <Time Stamp> - ? [128] Subsystem 'ANALYSISCOMMAND' stopped (exit code 1)\ |
56 | | - <Time Stamp> - ? [128] Subsystem 'ANALYSISQUERY' stopped (exit code 1)\ |
57 | | - <Time Stamp> - ? [128] Subsystem 'CmdExec' stopped (exit code 1)\ |
58 | | - <Time Stamp> - ? [128] Subsystem 'PowerShell' stopped (exit code 1)\ |
59 | | - <Time Stamp> - ? [128] Subsystem 'SSIS' stopped (exit code 1)\ |
60 | | - <Time Stamp> - ? [175] Job scheduler engine stopped\ |
61 | | - ``` |
62 | | -
|
63 | | -- **Scenario 3**: The database engine server displays a SQL Server process ID (SPID) from the "SQLAgent - Generic Refresher" service. Additionally, the following job is displayed as running in the input buffer of the SPID: |
| 18 | +A SQL Server Agent fails when you try to start it, or it takes longer than you expect to start. Additionally, you might experience one or more of the following scenarios: |
64 | 19 |
|
65 | | -```sql |
66 | | -EXECUTE msdb.dbo.sp_sqlagent_refresh_job |
67 | | -``` |
| 20 | +- **Scenario 1**: The following error message is logged in the [System event log](/host-integration-server/core/windows-event-viewer1): |
| 21 | + > The SQL Server Agent (MSSQLSERVER) service failed to start due to the following error: |
| 22 | + > The service did not respond to the start or control request in a timely fashion. |
| 23 | +- **Scenario 2**: The status of the agent appears as "Starting" in Control Panel, and the following error message is logged in the _SQLAgent.log_ file: |
| 24 | + > An idle CPU condition has not been defined - OnIdle job schedules will have no effect. |
| 25 | +
|
| 26 | + Additionally, the following entries might be logged in the _SQLAgent.log_ file: |
| 27 | + |
| 28 | + ```output |
| 29 | + <Time Stamp> - ? [431] Populating subsystems cache... |
| 30 | + <Time Stamp> - ? [432] There are 7 subsystems in the subsystems cache |
| 31 | + <Time Stamp> - ? [124] Subsystem 'ActiveScripting' successfully loaded (maximum concurrency: 40) |
| 32 | + <Time Stamp> - ? [124] Subsystem 'ANALYSISCOMMAND' successfully loaded (maximum concurrency: 400) |
| 33 | + <Time Stamp> - ? [124] Subsystem 'ANALYSISQUERY' successfully loaded (maximum concurrency: 400) |
| 34 | + <Time Stamp> - ? [124] Subsystem 'CmdExec' successfully loaded (maximum concurrency: 40) |
| 35 | + <Time Stamp> - ? [124] Subsystem 'PowerShell' successfully loaded (maximum concurrency: 2) |
| 36 | + <Time Stamp> - ? [124] Subsystem 'SSIS' successfully loaded (maximum concurrency: 400) |
| 37 | + <Time Stamp> - ? [124] Subsystem 'TSQL' successfully loaded (maximum concurrency: 80) |
| 38 | + <Time Stamp> - ! [364] The Messenger service has not been started - NetSend notifications will not be sent |
| 39 | + <Time Stamp> - ? [129] SQLSERVERAGENT starting under Windows NT service control |
| 40 | + <Time Stamp> - + [396] An idle CPU condition has not been defined - OnIdle job schedules will have no effect |
| 41 | + <Time Stamp> - ? [110] Starting SQLServerAgent Monitor using '' as the notification recipient... |
| 42 | + <Time Stamp> - ? [146] Request servicer engine started |
| 43 | + <Time Stamp> - ? [133] Support engine started |
| 44 | + <Time Stamp> - ? [167] Populating job cache... |
| 45 | + <Time Stamp> - ? [131] SQLSERVER service stopping due to a stop request from a user, process, or the OS... |
| 46 | + <Time Stamp> - ? [134] Support engine stopped |
| 47 | + <Time Stamp> - ? [197] Alert engine stopped |
| 48 | + <Time Stamp> - ? [168] There are 4731 job(s) [0 disabled] in the job cache |
| 49 | + <Time Stamp> - ? [170] Populating alert cache... |
| 50 | + <Time Stamp> - ? [171] There are 0 alert(s) in the alert cache |
| 51 | + <Time Stamp> - ? [149] Request servicer engine stopped |
| 52 | + <Time Stamp> - ? [248] Saving NextRunDate/Times for all updated job schedules... |
| 53 | + <Time Stamp> - ? [249] 0 job schedule(s) saved |
| 54 | + <Time Stamp> - ? [127] Waiting for subsystems to finish... |
| 55 | + <Time Stamp> - ? [128] Subsystem 'ActiveScripting' stopped (exit code 1) |
| 56 | + <Time Stamp> - ? [128] Subsystem 'ANALYSISCOMMAND' stopped (exit code 1) |
| 57 | + <Time Stamp> - ? [128] Subsystem 'ANALYSISQUERY' stopped (exit code 1) |
| 58 | + <Time Stamp> - ? [128] Subsystem 'CmdExec' stopped (exit code 1) |
| 59 | + <Time Stamp> - ? [128] Subsystem 'PowerShell' stopped (exit code 1) |
| 60 | + <Time Stamp> - ? [128] Subsystem 'SSIS' stopped (exit code 1) |
| 61 | + <Time Stamp> - ? [175] Job scheduler engine stopped |
| 62 | + ``` |
| 63 | + |
| 64 | +- **Scenario 3**: The database engine displays a `session_id` from the _SQLAgent - Generic Refresher_ service and the following job is displayed as query text running in that session: `EXECUTE msdb.dbo.sp_sqlagent_refresh_job` |
| 65 | + |
| 66 | +## Cause 1: Multiple job entries |
| 67 | + |
| 68 | +This issue can occur if you configure a large number of jobs in SQL Server Agent with many schedules. This configuration can continuously activate the Generic refresher task, keeping it in busy state. |
| 69 | + |
| 70 | +For example, the issue can occur if you unintentionally set up multiple subscriptions for your reports in the [SQL Server Reporting Services Configuration Manager](/sql/reporting-services/install-windows/reporting-services-configuration-manager-native-mode). |
| 71 | + |
| 72 | +### Workaround |
| 73 | + |
| 74 | +To work around this issue, delete the jobs that you don't need. |
| 75 | + |
| 76 | +If there are many job entries because you unintentionally set up many subscriptions, delete the unnecessary subscriptions by using the [Reporting Services Configuration Manager](/sql/reporting-services/install-windows/reporting-services-configuration-manager-native-mode). |
| 77 | + |
| 78 | +## Cause 2: ODBC driver missing or not functioning |
| 79 | + |
| 80 | +This issue can occur if the SQL Server [Open Database Connectivity (ODBC)](/sql/odbc/microsoft-open-database-connectivity-odbc) driver is removed or not functioning (often after system updates). SQL Server Agent uses the SQL Server ODBC driver to connect to SQL Server. If the driver is missing or not functioning, a SQL Server Agent fails to start. |
| 81 | + |
| 82 | +For information about the ODBC driver requirements for different versions of SQL Server, see [Hardware and software requirements for SQL Server](/sql/sql-server/install/hardware-and-software-requirements-for-installing-sql-server-2025). |
| 83 | + |
| 84 | +### Solution |
| 85 | + |
| 86 | +1. To check if the SQL Server ODBC driver is missing, run one of the following commands in an elevated Command Prompt window or PowerShell: |
| 87 | + 1. Command Prompt: |
| 88 | + |
| 89 | + ```cli |
| 90 | + odbcad32.exe |
| 91 | + ``` |
| 92 | +
|
| 93 | + This command opens the [ODBC Data Source Administrator](/host-integration-server/core/odbc-data-source-administrator). |
68 | 94 |
|
69 | | - > [!NOTE] |
70 | | - > The SPID is in the RUNNABLE state and regularly waits for the `PREEMPTIVE_OS_LOOKUPACCOUNTSID` wait type, or the SPID is in a waiting state for the `ASYNC_NETWORK_IO` wait type. |
| 95 | + 1. PowerShell: |
71 | 96 |
|
72 | | -## Cause |
| 97 | + ```powershell |
| 98 | + Get-OdbcDriver |
| 99 | + ``` |
73 | 100 |
|
74 | | -This issue occurs because there are multiple job entries in SQL Server. |
| 101 | + This command outputs a list of the installed ODBC drivers. |
75 | 102 |
|
76 | | -> [!NOTE] |
77 | | -> The issue can also occur if you unintentionally set up multiple subscriptions for your reports in the Reporting Services Configuration Manager. |
| 103 | +1. Check if the required SQL Server ODBC driver is present by comparing it to the table found in [SQL Server versions and ODBC and OLE DB drivers](/sql/connect/connect-history#sql-server-versions-and-odbc-and-ole-db-drivers). The table lists the version of the SQL Server ODBC driver shipped with each SQL Server engine and used by SQL Server Agent to connect to SQL Server engine. |
| 104 | + 1. If the required ODBC driver version is present, repair it by following the steps in [ODBC Driver is present](#odbc-driver-is-present). |
| 105 | + 1. If the ODBC driver is missing, install it by following the steps in [ODBC driver is missing](#odbc-driver-is-missing). |
78 | 106 |
|
79 | | -## Workaround |
| 107 | +#### ODBC driver is present |
80 | 108 |
|
81 | | -To work around this issue, delete the jobs that you don't require. |
| 109 | +1. Open **Add or Remove Programs** and select **Microsoft ODBC Driver \<Driver_Version\> for SQL Server**. |
| 110 | +1. Select the three dots (**...**) and choose **Modify**. |
| 111 | +1. In the wizard that opens, choose the **Repair** option and follow the steps to repair the driver. |
| 112 | +1. After you complete the repair steps, you can test the connection to SQL Server by configuring a test DSN with the repaired SQL Server driver. For more information, see [ODBC Data Source Administrator DSN options](/sql/connect/odbc/windows/odbc-administrator-dsn-creation). |
82 | 113 |
|
83 | | -> [!NOTE] |
84 | | -> If there are many job entries because you unintentionally set up many subscriptions, delete the unnecessary subscriptions by using Reporting Services Configuration Manager. |
| 114 | +#### ODBC driver is missing |
| 115 | +
|
| 116 | +1. [Download the ODBC Driver for SQL Server](/sql/connect/odbc/download-odbc-driver-for-sql-server). |
| 117 | +1. Install the driver by using the GUI or a silent installation. |
| 118 | + 1. To perform a silent installation, run the following command: |
| 119 | +
|
| 120 | + ```cli |
| 121 | + msiexec /i <ODBC_Driver_MSI> /qn |
| 122 | + ``` |
| 123 | +
|
| 124 | +1. After the driver installation finishes, restart the SQL Server Agent. |
| 125 | +1. Verify that the _SQL SERVER AGENT_ service is running. |
| 126 | + 1. For an unnamed SQL Server instance, run the following PowerShell command: |
| 127 | +
|
| 128 | + ```powershell |
| 129 | + Get-Service -Name SQLSERVERAGENT |
| 130 | + ``` |
| 131 | +
|
| 132 | + 1. For a named SQL Server instance, run the following PowerShell command: |
| 133 | +
|
| 134 | + ```powershell |
| 135 | + Get-Service -Name SQLAgent$<InstanceName> |
| 136 | + ``` |
| 137 | +
|
| 138 | +## Cause 3: Waiting for SQLAgent - Generic Refresher service |
| 139 | +
|
| 140 | +When SQL Server Agent starts, the _SQLAgent – Generic Refresher_ component runs the `msdb.dbo.sp_sqlagent_refresh_job` procedure to refresh job metadata. During this operation, SQL Server might repeatedly check Windows group membership for job owners or proxy accounts. These checks use [Windows API](/windows/win32/api/) calls, which can cause the session to enter one or more of the following wait types: |
| 141 | +
|
| 142 | +- `PREEMPTIVE_OS_LOOKUPACCOUNTSID` |
| 143 | +- `PREEMPTIVE_OS_AUTHORIZATIONOPS` |
| 144 | +- `ASYNC_NETWORK_IO` |
| 145 | +
|
| 146 | +Use the following query to identify the session and the associated command text: |
| 147 | +
|
| 148 | +```sql |
| 149 | +SELECT |
| 150 | + s.session_id, |
| 151 | + r.status, |
| 152 | + r.wait_type, |
| 153 | + r.wait_time, |
| 154 | + s.program_name, |
| 155 | + t.text |
| 156 | +FROM sys.dm_exec_requests AS r |
| 157 | +RIGHT JOIN sys.dm_exec_sessions AS s |
| 158 | + ON r.session_id = s.session_id |
| 159 | +OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t |
| 160 | +WHERE s.program_name = 'SQLAgent - Generic Refresher'; |
| 161 | +``` |
| 162 | + |
| 163 | +When this issue occurs, the session is in a _RUNNABLE_ state, and regularly waits for the `PREEMPTIVE_OS_LOOKUPACCOUNTSID` wait type. Or, the session is in a waiting state for the `ASYNC_NETWORK_IO` wait type. |
| 164 | + |
| 165 | +### Workaround |
| 166 | + |
| 167 | +To reduce delays related to Windows authorization lookups: |
| 168 | + |
| 169 | +- Ensure domain controllers are reachable and responsive. |
| 170 | +- Avoid using highly nested or very large [Active Directory](/windows-server/identity/ad-ds/get-started/virtual-dc/active-directory-domain-services-overview) groups for SQL Agent job ownership or proxy accounts. |
| 171 | +- Restart SQL Server Agent after significant Active Directory group membership changes to refresh the service account’s access token. |
| 172 | +- Consider using SQL logins instead of AD groups for job ownership when appropriate. |
| 173 | +- Review SQL Agent jobs and proxies to identify Windows principals that might contribute to expensive Windows security lookups. |
85 | 174 |
|
86 | 175 | ## More information |
87 | 176 |
|
88 | 177 | - For more information about how to delete a job, see [Delete One or More Jobs](/sql/ssms/agent/delete-one-or-more-jobs). |
89 | | -- For more information on managing your reporting services subscriptions, see [Create and Manage Subscriptions for Native Mode Report Servers](/sql/reporting-services/subscriptions/create-and-manage-subscriptions-for-native-mode-report-servers?redirectedfrom=MSDN). |
| 178 | +- For more information about how to manage your reporting services subscriptions, see [Create and Manage Subscriptions for Native Mode Report Servers](/sql/reporting-services/subscriptions/create-and-manage-subscriptions-for-native-mode-report-servers?redirectedfrom=MSDN). |
90 | 179 | - For more information about various wait types, see [SQL Server wait types](/sql/relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql). |
91 | | - |
|
0 commit comments