How can we help you today? How can we help you today?
Brian Donahue
Hi Lindsey, Usually the opposite is true -- jobs fail without reporting back to the SQL Agent and end up as a success. This is because SQL Backup's extended stored procedure does not raise errors back to the SQL Agent; it sets a return code and a SQL-specific return code. The bit that is flagging the job as failed appears lower down in the script than the snippet you'd sent. If you look for the RAISERROR command, this is the bit you're interested in. Normally, you want to flag only error codes greater than 500, otherwise your job will be flagged as an error when mail could not be sent or the SQL Backup Agent had to retry because there was not enough free contiguous VAS memory. For example: DECLARE @errorcode INT DECLARE @sqlerrorcode INT EXECUTE master..sqlbackup '-SQL "BACKUP LOG [database] TO DISK = ''D:\sql2005\MSSQL.1\MSSQL\Backup\<TYPE>_<DATABASE>_<DATETIME YYYYmmddhhnnss>.sqb'' WITH DISKRETRYINTERVAL = 30, DISKRETRYCOUNT = 10, COPYTO = ''\\server\Backup'', THREADCOUNT = 2"', @errorcode OUT, @sqlerrorcode OUT; IF (@errorcode >= 500) OR (@sqlerrorcode <> 0) BEGIN RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @errorcode, @sqlerrorcode) END / comments
Hi Lindsey, Usually the opposite is true -- jobs fail without reporting back to the SQL Agent and end up as a success. This is because SQL Backup's extended stored procedure does not raise errors b...
0 votes
You probably also want to add to your backup script: MAILTO=''%irm_mssql_dbas%'' This will work if you have more than one email address in the variable, but only if they're separated by commas! / comments
You probably also want to add to your backup script: MAILTO=''%irm_mssql_dbas%'' This will work if you have more than one email address in the variable, but only if they're separated by commas!
0 votes