You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: support/sql/database-engine/agent/job-failed-error-258.md
+74-2Lines changed: 74 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Troubleshoot SQL Agent Job Failures with Error 258
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.
3
+
description: Troubleshoot SQL Agent job failures with error 258. Learn how to resolve timeout issues, fix registry problems, and ensure stable job execution.
@@ -27,11 +27,83 @@ Logon to server '<ServerName>' failed (ConnLogJobHistory)
27
27
28
28
This issue can be caused by any of the following underlying problems:
29
29
30
-
- Blocking of`msdb` system tables used by Agent, which prevents job metadata reads and writes.
30
+
- Blocking on`msdb` system tables used by Agent, which prevents job metadata reads and writes.
31
31
- Example system tables: `dbo.sysjobs`, `dbo.sysjobschedulers`, and `dbo.jobsteps`.
32
32
- Hangs inside important SQL Server Agent threads or other process-level problems.
33
33
- Worker thread exhaustion in SQL Server (no workers available), making the Agent unable to connect or process schedules.
34
34
35
35
## Solution
36
36
37
+
1. Confirm that the SQL Server Agent service is running by using the following PowerShell command:
37
38
39
+
```powershell
40
+
Get-Service -Name "SQLSERVERAGENT"
41
+
```
42
+
43
+
1. If the SQL Server Agent service is not already running, start it.
44
+
1. Check the jobs and schedules in `msdb` by opening [SQL Server Management Studio (SSMS)](/ssms/install/install) and running the following query: <!-- Check with SME, what the user should do with the output of this query -->
45
+
46
+
```tsql
47
+
USE msdb;
48
+
GO
49
+
50
+
-- List enabled jobs
51
+
SELECT name, enabled, description FROM msdb.dbo.sysjobs WHERE enabled = 1;
52
+
GO
53
+
54
+
-- Show job schedules and next run
55
+
SELECT s.name AS ScheduleName,
56
+
j.name AS JobName,
57
+
s.enabled AS ScheduleEnabled,
58
+
s.active_start_date,
59
+
s.active_end_time
60
+
FROM msdb.dbo.sysjobs j
61
+
JOIN msdb.dbo.sysjobschedules js ON j.job_id = js.job_id
62
+
JOIN msdb.dbo.sysschedules s ON js.schedule_id = s.schedule_id
63
+
WHERE j.enabled = 1;
64
+
GO
65
+
```
66
+
67
+
1. Detect blocking on `msdb` Agent system tables by running the following query is SSMS:
1. If blocking sessions are found, investigate the blocking query using `sys.dm_exec_requests` and `sys.dm_exec_sql_text`. Then, resolve or kill the blocking session.
82
+
1. Check the system health extended events for any worker, thread, or resource issues by running the following query is SSMS:
83
+
84
+
```tsql
85
+
?????
86
+
```
87
+
88
+
Inspect the query results for `QUERY_PROCESSING`, `RESOURCE`, and `SYSTEM` components, look for thread exhaustion, memory pressure, or CPU issues.
89
+
90
+
<!-- Check with SME what the user should do if they identify any thread exhaustion, memory pressure, or CPU issues -->
91
+
92
+
1. If blocking, hangs, or worker exhaustion can't be resolved, restart SQL Server Agent by running the following commands in PowerShell:
93
+
94
+
```powershell
95
+
Restart-Service -Name "SQLSERVERAGENT" -Force
96
+
net stop "SQL Server Agent (MSSQLSERVER)"
97
+
net start "SQL Server Agent (MSSQLSERVER)"
98
+
```
99
+
100
+
> [!IMPORTANT]
101
+
> Restarting the SQL Server Agent will interrupt any currently running jobs.
102
+
103
+
After the SQL Server Agent restarts, verify that jobs are now being executed by using the [Job Activity Monitor](/ssms/agent/monitor-job-activity#job-activity-monitor).
104
+
105
+
## Related content
106
+
107
+
- [SQL Server Agent overview](/ssms/agent/sql-server-agent)
108
+
- [View the SQL Server Agent error log](/ssms/agent/view-sql-server-agent-error-log-sql-server-management-studio)
109
+
- [Create a SQL Server Agent job](/ssms/agent/create-a-job)
0 commit comments