March 21, 2014 at 1:48 pm
I want to kill a running job in studio query window but can't.
How to use script to kill this job?
March 21, 2014 at 2:15 pm
adonetok (3/21/2014)
I want to kill a running job in studio query window but can't.
Well!! get a gun or hire a shooter.
adonetok (3/21/2014)
How to use script to kill this job?
What is the job doing?
Using DMVs find out session id that is running the agent job process.
or do simple sp_who2 and search for CORRECT session id or SPID with program name like "SQLAgent - TSQL JobStep (Job <<job_id>> : <<Step_id>>)" then run
KILL <<session_id>>
Be cautious before you run KILL, it rolls back the DMLs and in some situations it may take time to finish kill process.
March 21, 2014 at 2:18 pm
...and in some cases, you'll get stuck with a "Zero Rollback' that doesn't do anything except consume CPU time.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 24, 2014 at 10:28 pm
You can open the Job Activity Monitor in SSMS by right clicking Job Activity Monitor and selecting View job Activity. find the job you want to kill, right click it and select Stop Job.
March 24, 2014 at 10:47 pm
First try STOP JOB from JOB ACTIVITY MONITOR. Check the status of the job if it is rollback than wait else as a second option find session id and KILL Session_id
HTH
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply