June 3, 2009 at 4:19 am
Hello Guys and Girls,
I was wondering if anyone can explain what the following statements does:
...
" exec msdb.dbo.sp_update_job @job_name='dvjob_MyJobName', @enabled=0" + NL +
" dbcc shrinkdatabase(@dbname, notruncate)" + NL +
" exec msdb.dbo.sp_update_job @job_name='dvjob_MyJobName', @enabled=1" + NL
... the above is an extraction of some java code. I read the storedproc called sp_update_job, but it is all geek to me at the moment. What does it mean to enable or disable the job, what happens when this is done?
The aim is to understand what this does, in order to make a decision how to progress with my current project...:w00t:
June 3, 2009 at 6:53 am
Hello,
I think this code is just to prevent the Job from running while a (DBCC) Shrink-Database is in progress i.e.
1) Disable job
2) Shrink the database
3) Re-enable the job
When a job is disabled (Enabled = 0) it will not run on its schedule(s).
Regards,
John Marsh
www.sql.lu
SQL Server Luxembourg User Group
June 3, 2009 at 8:59 am
John is right. I just wanted to comment that shrinking your database is not normally a good idea. There is usually a reason why it grew and it will grow again.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
June 4, 2009 at 1:01 am
Thank you for your input - this solves my problem, as I can now continue with my project...:-)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply