Red Gate forums :: View topic - Mailto_on warning and error?
Return to RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Backup 7
SQL Backup 7 forum

Mailto_on warning and error?

Search in SQL Backup 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message

Joined: 21 Dec 2007
Posts: 25

PostPosted: Tue May 08, 2012 9:57 pm    Post subject: Mailto_on warning and error? Reply with quote

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 = '''', 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?

Back to top
View user's profile Send private message

Joined: 24 Apr 2005
Posts: 2306

PostPosted: Wed May 09, 2012 1:40 am    Post subject: Reply with quote

The log shipping job is ran as a SQL Server Agent job, which has to connect to the SQL Server instance first to pass the restore command to SQL Backup.

If your SQL Server instance was unavailable, SQL Backup did not have a chance to process the request, hence why no e-mail was sent out. In these cases, you would need to set up alert notifications on the SQL Server Agent job itself.
Peter Yeoh
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 7
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group