Enable=1 does not reactivate schedule of a job

  • Hi

    In SMS when I enable a disabled job, the next run field is updated.

    When I do this by setting enable = 1 in sysjobs, the next run is not updated, and the job nevers starts.

    What an I missing ?

    Patrick - sql 2008

  • Do you mean , you are updating the value directly in the system tables. if yes: this is not advisable and should be dne through the Job properties only. as the vvalue might be updates into several sys tables....

  • Patrick ISAMBERT (6/23/2009)


    Hi

    In SMS when I enable a disabled job, the next run field is updated.

    When I do this by setting enable = 1 in sysjobs, the next run is not updated, and the job nevers starts.

    What an I missing ?

    It could be because the job and schedule are stored in different system tables and when you enable a job using the GUI, the next run date is is updated behind the scenes. When you update sysjobs manually, you're not updating sysjobschedules.

    Remember also that jobs and schedules can be enabled or disabled independently, so when you enable a job you should make sure that the schedule is also enabled.

    Greg

  • If you want to enable \ disable the jobs through tsql please dont update the systables directly instead MS has provided a procedure to do this in MSDB database. Try the procedure below, it will disable the schedule too.

    EXEC msdb.dbo.sp_update_job @job_name='Jobname', @enabled=0

  • I believe you have to run msdb.dbo.sp_update_jobschedule to disable a schedule.

    Greg

  • Thanks to all of you

    Effectively, updating system tables directly was a bad idea ....

    Patrick

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply