Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 sql server job for backup - generates error

Author  Topic 

deiush
Starting Member

2 Posts

Posted - 2010-07-20 : 04:55:30
Hi all,

I have a job that uses the utility sqlmaint to create backups for user dbs on one sql server 2005. in case in the corresponding step an error appears, the job is set to go to next step. now - the problem is that after the sqlmaint throws an error, it does not come out immediately - but still executes few more statements - i saw them in profiler (but without any export in step's report file). this seams very strange to me. please help. i have no more ideas (i tried try / catch, returned value from backup execution, more raiserrors...)

10x

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-07-20 : 07:58:49
It will run a few more statements as it is writing to the history and logs and leaving the database in a recoverable state.

Can you be more specific about what it is running that you do not want to run?
Go to Top of Page

deiush
Starting Member

2 Posts

Posted - 2010-07-20 : 08:27:24
we have few jobs that are included in a nice (custom) maint. plan. so we keep a list (temp table) of databases that are still to be backed up (because we don't run other jobs on one db until it is not backed up - for example - log shrinking)
in order to do backup - we use sqlmaint - to create new bkp, and to delete old ones. this is included in a try-catch structure. if nothing wrong is happening, we delete the db from list (actually - an ordered queue). if some error is caught, the db is moved to the end of the queue and we go on with other db's. but the error that is thrown by sqlmaint is not caught by try-catch - so the step should end with error - and i really would expect to end in the moment sqlmaint ends... but... still executes some more statements (it deletes the db from queue and in that "while" on queue it is already taking the next db in line)... and then really ends
Go to Top of Page
   

- Advertisement -