Home Dashboard Directory Help
Search

BACKUP generates two errors by Victor Girling


Status: 

Closed
 as Won't Fix Help for as Won't Fix


8
0
Sign in
to vote
Type: Suggestion
ID: 785656
Opened: 4/26/2013 2:58:14 AM
Access Restriction: Public
0
Workaround(s)
view

Description


If a BACKUP command fails it generates two error. The first the ERROR_NUMBER() you want. The second a generic failure ERROR_NUMBER() i.e. 3013 for BACKUP LOG.

This means that using TRY CATCH and initiating a proper response to a BACKUP LOG failure is very difficult.

Scenario A is using a BACKUP LOG <dbname> TO DISK = <Path> MIRROR TO DISK = <Path>.
I want to trap the error 3215. This is so I can switch to a WITH FORMAT.

Scenario B is that I am sending an output of errors to a log table. The error being sent to the log table tells me what I already know, the BACKUP has failed. So I need to run the task again to understand what the reason of the failure is. In the event of the failure being transient or a one off failure means that I would either not have the error or I'd need to use log files on the SQL job and not use TRY CATCH.

Details
Sign in to post a comment.
Posted by Microsoft on 4/29/2013 at 10:43 AM
Hello Victor,
Thanks for your feedback. We are already tracking a request that will allow you to capture the entire error stack in the CATCH block. We will look at that for a future version of SQL Server. Also, in SQL Server 2012 if you use THROW in the catch block to rethrow the error you will get all the error messages but you can only consume that in the client-side.
Otherwise, I am closing this request as won't fix since we don't have plans to change the backup execution mechanism.

--
Umachandar, SQL Programmability Team
Sign in to post a workaround.