Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling - Backup Log - Operational Operation

Status
Not open for further replies.

farhy

Programmer
Jun 20, 2003
22
AT
Hi,

when backuping transaction logs I want to realize some error handling.

But if during the backup the share is renamed the error handling ist not working anymore.

I read that a few errors are not catched by "try error", I think this kind of operation system error can not be catched by

"try error", how can such an error be handled within a procedure.

---------------------------------------------------------------------------------
Error message:

Cannot open backup device 'C:\backup\WEBTest_20071009112432.trn'. Operating system error 3(error not found). [SQLSTATE 42000] (Error 3201).


The steps looks like that:

begin try

backup log @db
to
disk = @filepath1
with
format;

end try

begin catch
Print 'error';
end catch
 
The try/catch does run the catch when a backup command fails, however it doesn't appear to block the error from being thrown as you would expect.

A database backup failing shouldn't stop the procedure (it's level 16). The best you will be able to do it wrap it in a try/catch and handle it within the catch, then set the job to return success no matter what.

You should also post this as a bug to the developers of SQL Server via
Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top