SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Check Jobs Current State

By GabeGreen,

Total article views: 1073 | Views in the last 30 days: 8

I created this script in an attempt to better automate many different jobs that run each morning, as part of a datawarehouse build. I use it to not only tell me what jobs are currently running (so that I can manage how many I would like to run at a time), but what happened to the job after it completed (or not). The parameters are: @jobs = Comma seperated list of jobs to check @is_running = Should the procedure wait until the job indicates that it is "running" or not. @max_seconds = How long should the procedure wait for the job to indicate whether it is "running" or not. @pause_seconds = Controls the interval of time between job status checks. @retrying_equals_running = Should a "retrying" state be considered as "running" The procedure returns the job status as an integer that indicates the following: 1 - successfull 2 - retrying 3 - cancelled -1 - not started -2 - executing 0 - failed If anyone is interested, I can post the scheduling procedure as well... I'll wait to see the ratings that this script gets. Gabe Green

By GabeGreen,

Total article views: 1073 | Views in the last 30 days: 8
Your response
 
 
Related Articles
FORUM

SSIS Flat File read error retry?

How to retry a locked file?

FORUM

WaitForChildren: Children persisting. Retry

Cannot kill the spid relating to the log entry WaitForChildren: Children persisting. Retry

BLOG

The Database Hive for SQL Server DBAs - Configuring Auto-Retry on SQL Server Agent

The goal of this post is to explain how to take advantage of Auto-Retry and why you will want to use...

FORUM

Procedure with variables Null should be all

A question about procedures

FORUM

WaitForChildren: Children persisting. Retry: 12765

Hi all. I have a 20 db server for online forums. Twice a month i restart the server because forums...

 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com