How to kill running job?

  • I want to kill a running job in studio query window but can't.

    How to use script to kill this job?

  • 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.

  • ...and in some cases, you'll get stuck with a "Zero Rollback' that doesn't do anything except consume CPU time.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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.

  • 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