Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have created and am using an SQL Agent for the first time. I have searched google but either the info isnot there or I am not getting the keywords correct (SQL agent + back log/callstack overflow etc !).

My agent reads in and does some processing on a (variable) volume of data. I observed an error recently where i deadlocked a database i think due to an issue with the SQL agent and it started me thnking about the following: If I set the schedule frequency to be shorter than the duration that it took to compete the action that is performed by the agent, such that the 2nd action is scheduled while the first is still processing ...and so on. Will this generate an unrecoverable situation by accumulating jobs that it will never have time to process or if the agent starts while a previous job is still running does it just abandon the attempt and check again at the next scheduled interval.

Obviously one wouldnt want to do the above on purpose but it just got me thinking about whether i need to handle for the above possibility.

Cheers

share|improve this question
    
Can you please share more details? I guess you've created a SQL Server job that runs multiple times a day and it is involved in a deadlock. Can you tell us what you job does? what frequency it runs? How did you find about the deadlock? –  yogirk Apr 1 '13 at 6:00
add comment

migrated from stackoverflow.com Apr 1 '13 at 5:16

This question came from our site for professional and enthusiast programmers.

2 Answers

If you're job is running at the time the next scheduled execution comes along it will be skipped

http://stackoverflow.com/questions/865042/will-a-sql-server-job-skip-a-scheduled-run-if-it-is-already-running

share|improve this answer
add comment

If you want to make sure that Job 2 doesn't start its processing while Job 1 is running, then you could make the first step of Job 2 be a call to sp_help_job, which you can use to check the run status of a job (it's the current_execution_status field).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.