Quantcast
Channel: SQLServerCentral » SQL Server 2008 » SQL Server 2008 Administration » Latest topics
Viewing full articles (3118 articles)
Browse article index
↧

Non-explanatory backup error message

$
0
0
I have a database backup wrapped in a try/catch. It failed but the output in ERROR_MESSAGE is less than helpful. [b]BACKUP DATABASE is terminating abnormally.[/b][code="sql"]DECLARE @msg VARCHAR(MAX), @ErrorMessage NVARCHAR(4000);BEGIN TRY BACKUP DATABASE [MyDatabase] TO DISK = N'G:\SQLBackup\MyDatabase_Backup.bak' WITH INIT, NAME = N'MyDatabase Backup', SKIP END TRYBEGIN CATCH SELECT @ErrorMessage = ERROR_MESSAGE(); SET @msg = 'Backup DB1 Job [usp_BackupDatabases] Failed on MyDatabase - '; SET @msg += @ErrorMessage; EXECUTE NOC2.dbo.usp_InsertMessage 43, 101, @msg; -- Insert error message into a tableEND CATCH[/code]This is the line inserted into the table: [b]Backup DB1 Job [usp_BackupDatabases] Failed on MyDatabase - BACKUP DATABASE is terminating abnormally.[/b]So what do I need to get a more explanatory error message i.e. why did the backup fail?
↧

Viewing full articles (3118 articles)
Browse article index

Latest Images

Trending Articles



Latest Images