SQL Server (SQL) Server Agent Job not stopping

vh0rcniy  于 2023-11-16  发布在  其他
关注(0)|答案(2)|浏览(109)

I am using SQL Server 2016, and have some Jobs running in the SQL Server Agent. Today I found one of the job is taking too long (10hours!) to run and is still processing, so I try to stop that. I tried right-click and stop the job, it showed a success message. However, when I go to the Job Activity Monitor, it is showing that the job is still running! I also tried the following code:

USE [msdb]
GO
EXEC dbo.sp_stop_job N'Process Reserving MI (except problematic tables)' 
GO

It also says the job stopped successfully. But again when I go to the Job Activity Monitor, it is showing that the job is still running!

Can any one please help?

v6ylcynt

v6ylcynt1#

At the end I have to ask the server team to reboot the server in order to solve this problem

68de4m5k

68de4m5k2#

I had a similar issue where a reoccuring maintenance task (15 minute intervals) was running, would not stop, and could not be run again because it was apparently already running.

My solution was to restart the SQL Server Agent service for that SQL instance. The below is a quick guide on how I did it in my environment (Windows Server 2022 running SQL Server Standard 2016)

  1. Win + R
  2. Run "services.msc"
  3. Find service named "SQL Server Agent (InstanceName)" where the InstanceName is your SQL Server Instance Name.
  4. Right Click ther Service
  5. Choose "Restart"

This way you're not potentially reboot a production server. Your solution of rebooting the server though did help me formulate this solution. This forced the unstoppable job to stop, and I was able to execute it manually, and it successfully followed the schedule moving forward.

相关问题