Disable job in maintenance plan fails

  • Hi there,

    I have a problem with a maintenance plan task which executes a query to disable and later on enables a certain job.

    The maintenance plan consists of two subplans:

    - Daily Maintenance & Cleanup

    - Weekly Maintenance & Cleanup.

    The daily subplan runs every day at 20:00. The weekly runs once a week on different schedules starting at 19:55.

    To save time I only create specific schedules in the weekly where the weekly also disables the daily.

    The daily and the weekly may not run on the dame day.

    This all works and runs fine during the week.

    When the weekly job runs it first disables the daily job. This works fine.

    The weekly runs through all the tasks and at the end it has a task to enable the daily job again.

    I use the following code to enable and disable the daily job:

    Disable job

    EXEC msdb.dbo.sp_update_job @job_name=N'ITSSC Maintenance Plan.Daily Maintenance & Cleanup', @enabled=0

    Enable job

    EXEC msdb.dbo.sp_update_job @job_name=N'ITSSC Maintenance Plan.Daily Maintenance & Cleanup', @enabled=1

    See the attached screenshot how the tasks are setup.

    The only thing is that the disabling works fine but the enabling, which is the same query with a different value on a aparemeter, fails.

    The extended logging of the maintenance plan doesn't show anything special.

    The jobs run without any errors.

    Doesn anybody know what I did wrong?

    Thanx in advance

  • Seems fine. If you manually run the job for the subplan does the step still fail? You may have to run a trace to see what is going on during that time and where you are getting your error.

    Joie Andrew
    "Since 1982"

Viewing 2 posts - 1 through 1 (of 1 total)

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