August 28, 2008 at 8:33 am
I wrote a job that performs daily maint on a db. Two of the steps are defragging the indexes, and then updating the statistics. When looking back on some logs -- it looks as though statistics start to be updated while they are still being defragmented.
Is there a way to force the statistics step to wait until the defrag step is complete? ...and I would not like to use a time delay as the time will vary.
Or, maybe an alt question -- How do I make the defrag step wait until it is done to move to the next step?
Thank you for your time. 🙂
August 28, 2008 at 8:36 am
If you have the commands in separate steps the second step should not start until the first step completes. Unless there is a bug because of multiple processors and parallelism.
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
August 28, 2008 at 8:37 am
Are they not separate steps in the job?
August 28, 2008 at 8:52 am
There are separte steps. It looks as though the alter database command to defrag the index is complete, but is still running in the background.
The job that defrags the indexes is actually calling a stored procedure. Could this cause a problem by chance?
Maybe I should run a more detailed trace at this time to see exactly when everything starts and finishes.... I was able to see that the stat were being updated before the fragmentation was complete by looking at a trace that is capturing Audit Schema Object Management Event.
Here is my verison info:
Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
August 28, 2008 at 9:31 am
Thanks for all of your input. I found my error -- more of a user error on this one. 🙂 The steps and jobs are running as designed. I'll start a different thread for the question that should have been posted.
Have a great day!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply