Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Disable job in maintenance plan fails Expand / Collapse
Author
Message
Posted Monday, October 29, 2012 12:55 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 4:42 AM
Points: 426, Visits: 554
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




  Post Attachments 
screenshot.png (16 views, 31.51 KB)
Post #1378123
Posted Monday, October 29, 2012 12:38 PM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, December 18, 2014 11:07 AM
Points: 710, Visits: 1,452
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"
Post #1378410
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse