Alert notification not sent!

Dear all,

I've set up an alert notification like this:

 EXEC sys.sp_addmessage    @msgnum = 50002 /* INT */
                         ,@severity = 16 /* SMALLINT */
                         ,@msgtext = N'My custom error' /* NVARCHAR(255) */
                         ,@with_log = 'TRUE' /* VARCHAR(5) */
 USE [msdb]
 EXEC msdb.dbo.sp_add_alert @name=N'! - My custom error occured', 
         @notification_message=N'Fix it!', 
 EXEC sp_add_notification  @alert_name =  '! - My custom error occured' , 
      @operator_name = 'Operator' , 
      @notification_method =  1

If I try to raise an error like this:

 RAISERROR(50002, 16, 1);

No email is sent. It works fine in our test environment.

SQL Server Agent Alert System is configured properly.

Thanks for your feedback!

more ▼

asked Mar 12, 2014 at 02:06 PM in Default

avatar image

2.2k 18 24 31

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I have to ask... does a Database Mail test email work fine?

Your Mail Session in SQL Agent is set to Database Mail with a valid profile?

You've double-checked that the Alert is enabled?

more ▼

answered Mar 12, 2014 at 02:58 PM

avatar image

12.1k 30 36 42

Database Mail test email work fine? --> check! valid profile? --> check! Alert is enabled? --> check!

I will try to ask my os-server administrator to restart SQL Server Agent, hope that helps...

Mar 12, 2014 at 04:33 PM eghetto

Have you checked the alert's history to see if it "saw" the attempt?

Mar 12, 2014 at 05:06 PM Blackhawk-17

I know I've had this before... try un-checking the enable Mail Session, restart SQL Agent, check enable again and restart once more. No idea why it works but...

Mar 12, 2014 at 05:16 PM Blackhawk-17

Yeah - restart did the trick! Thanks!

Mar 13, 2014 at 10:45 AM eghetto
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Mar 12, 2014 at 02:06 PM

Seen: 541 times

Last Updated: Mar 13, 2014 at 10:45 AM

Copyright 2018 Redgate Software. Privacy Policy