Results 1 to 11 of 11

Thread: How to capture information of any jobs that are hanging?

  1. #1
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80

    How to capture information of any jobs that are hanging?

    How to capture information of any jobs that are hanging( for example, that are running for more than 6 hours) and send an alert in the email with job name and duration it has been running?

    Thanks,

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  3. #3
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    Thank you, MAK.

  4. #4
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    Hi MAK,

    This script is working fine except that is not capturing the jobs that are hanging in 'Performing completion tasks' state. Do you know how to capture the jobs in the above state and are hanging in the same state for ever?

    Thanks,

  5. #5
    Join Date
    Sep 2002
    Posts
    5,938
    Tried msdb..sp_help_job? Check jobs with @execution_status = 7.

  6. #6
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    But how do we incorporate this in the above script so that the alert will pic-up the jobs in this status as well?

    Thanks,

  7. #7
    Join Date
    Sep 2002
    Posts
    5,938
    You can send sql mail with job name if you get non-null result.

  8. #8
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    can you please explain me how to do it?

  9. #9
    Join Date
    Sep 2002
    Posts
    5,938
    Try something like following:

    master..xp_sendmail @query = 'msdb..sp_help_job @execution_status = 7 ...' ...

  10. #10
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    Hi MAK, Need your help here!!! Please let me know how to capture and send an alert with the condition mentioned above in your original script preferably.

    Thanks in advance.

  11. #11
    Join Date
    Aug 2004
    Location
    USA
    Posts
    80
    Gurus!

    Anyone to help me??

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •