Skip to content

Commit 7d3060f

Browse files
committed
Add cause section for scenario 3
1 parent 3aa26f7 commit 7d3060f

1 file changed

Lines changed: 38 additions & 14 deletions

File tree

support/sql/database-engine/startup-shutdown/sql-server-agent-crashes-upon-start.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,7 @@ A SQL Server Agent fails when you try to start it, or it takes longer than you e
6161
<Time Stamp> - ? [175] Job scheduler engine stopped
6262
```
6363

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-
You can use the following query to check for such session and text:
67-
68-
```sql
69-
SELECT s.session_id, r.status, r.wait_type, r.wait_time, s.program_name, t.text
70-
FROM sys.dm_exec_requests AS r
71-
RIGHT JOIN sys.dm_exec_sessions s
72-
ON r.session_id = s.session_id
73-
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) t
74-
WHERE s.program_name = 'SQLAgent - Generic Refresher'
75-
```
76-
77-
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.
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`
7865

7966
## Cause 1: Multiple job entries
8067

@@ -148,6 +135,43 @@ For information about the ODBC driver requirements for different versions of SQL
148135
Get-Service -Name SQLAgent$<InstanceName>
149136
```
150137
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 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 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.
174+
151175
## More information
152176

153177
- For more information about how to delete a job, see [Delete One or More Jobs](/sql/ssms/agent/delete-one-or-more-jobs).

0 commit comments

Comments
 (0)