I have a log shipping job setup using SQL BACKUP 6.5 and it send a log file every 15 minutes.
The log shipping process works fine but yesterday the server went down for 3 hours and we still did not receive any emails. Is it not supposed to send us an email notifying us that the machine is unreachable?
DECLARE @errorcode INT
DECLARE @sqlerrorcode INT
EXECUTE master..sqlbackup '-SQL "RESTORE LOG [DBname] FROM DISK = ''\\\\server1\\redgate\\dbname\\LOG_*.sqb'' WITH ERASEFILES = 15, FILEOPTIONS = 1, MAILTO_ONERRORONLY = ''email@example.com'', STANDBY = ''D:\\logs\\dbname\\UNDO_dbname.dat'', MOVETO = ''D:\\logs\\dbname''"', @errorcode OUT, @sqlerrorcode OUT;
IF (@errorcode >= 500) OR (@sqlerrorcode <> 0)
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @errorcode, @sqlerrorcode)
We do receive emails on some of the other alerts. Do we need to change something in the above script to receive warnings and errors?