Reporting Backup Errors to SQL Agent
RGnk
Posts: 3
Hi,
We are encountering backup errors with v 5.1.0.2781. The error message we receive is "Warning 210: Error writing to backup file \\\RemoteServer\Directory\File.sqb System error (The specified network name is no longer available)...Process terminated unexpectedly. Error code -2139684860... SQL error 3013: BACKUP DATABASE is terminating abnormally."
However, the backup is being run via a SQL Agent Job (2000 sp4) and the agent is reporting success. This prevents me from retrying the backup. I am only seeing the error in the redgate GUI.
Can anyone suggest why I am failing to pass the error event back to the SQL Agent? The script I am using is as follows:
DECLARE @exitcode int
DECLARE @sqlerrorcode int
EXECUTE master..sqlbackup N'-SQL "BACKUP DATABASE [MyDb] TO DISK = ''\\RemoveServer\RemoteDirectory\MyDb.sqb''
WITH VERIFY, COMPRESSION = 2, INIT"'
IF (@exitcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END
Any help greatly appreciated.
We are encountering backup errors with v 5.1.0.2781. The error message we receive is "Warning 210: Error writing to backup file \\\RemoteServer\Directory\File.sqb System error (The specified network name is no longer available)...Process terminated unexpectedly. Error code -2139684860... SQL error 3013: BACKUP DATABASE is terminating abnormally."
However, the backup is being run via a SQL Agent Job (2000 sp4) and the agent is reporting success. This prevents me from retrying the backup. I am only seeing the error in the redgate GUI.
Can anyone suggest why I am failing to pass the error event back to the SQL Agent? The script I am using is as follows:
DECLARE @exitcode int
DECLARE @sqlerrorcode int
EXECUTE master..sqlbackup N'-SQL "BACKUP DATABASE [MyDb] TO DISK = ''\\RemoveServer\RemoteDirectory\MyDb.sqb''
WITH VERIFY, COMPRESSION = 2, INIT"'
IF (@exitcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END
Any help greatly appreciated.
Comments
In your case, it appears that error 620 is not being raised, which is why the SQL Backup Agents failed to recognise the error, since it is set up to only captures error codes (>= 500). Warning codes have values less than 500.
Could you please post the contents of the SQL Backup log for this backup? The default folder for logs is C:\Documents and Settings\All Users\Application Data\Red Gate\SQL Backup\Log\<instance name>. Thanks.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
SQL Backup log file
14/12/2007 02:00:08: Backing up Mydb (full database) to:
14/12/2007 02:00:08: \\RemoteServer\backup\sql backups\MyDb\MyDbFull.sqb
14/12/2007 02:00:08: BACKUP DATABASE [MyDb] TO DISK = '\\RemoteServer\backup\sql backups\MyDb\MyDbFull.sqb' WITH NAME = '<AUTO>', DESCRIPTION = '<AUTO>', INIT, VERIFY, COMPRESSION = 2
14/12/2007 03:06:25: Thread 0 error:
Error 620: Error writing to backup file(s).
Process terminated unexpectedly. Error code: -2139684860
14/12/2007 03:06:25: Warning 210: Thread 0 warning:
Warning 210: Error writing to backup file: \\RemoteServer\backup\sql backups\MyDb\MyDbFull.sqb
Warning: System error (The specified network name is no longer available)
SQL error 3013: SQL error 3013: BACKUP DATABASE is terminating abnormally.
SQL error 3202: SQL error 3202: Write on 'SQLBACKUP_EB06F3CF-150D-4F98-A8A7-C831F3E5B755' failed, status = 112. See the SQL Server error log for more details.
DECLARE @exitcode int
DECLARE @sqlerrorcode int
EXECUTE master..sqlbackup N'-SQL "BACKUP DATABASE [MyDb] TO DISK = ''\\RemoveServer\RemoteDirectory\MyDb.sqb''
WITH VERIFY, COMPRESSION = 2, INIT, @exitcode OUTPUT, @sqlerrorcode OUTPUT"'
IF (@exitcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END
Red-Gate support
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8