February 28, 2013 at 12:45 pm
DBMail was installed on a 2008 SQL Server platform. Profile, alerts and job monitoring were setup. Due to other environment problems - all alerts and job monitoring were disabled. We had other issues which would have sent 50-100 emails a day (I had a few hours of that).
Once these issues were resolved, alerts and job monitoring were re-enabled - then bounced the SQL Server agent. Sending a test DB mail failed (Error: 14641 - Database Mail is stopped). Running sysmail_help_status_sp showed the DBMail was stopped.
While researching (I decided not to run sysmail_start_sp initially), I noticed 2 job notification emails sent well after bouncing the SQL agent (two days later). Running sysmail_help_status_sp yielded the same - dbmail was still stopped.
My question - how is it that DBMail service appears stopped yet DBMails are generated? Comments / URLs are appreciated.
Thank you.
February 28, 2013 at 1:30 pm
If I remember correctly, DBMail is the service which actually sends the email but is NOT the service the queues them up to be sent so SQL Server will queue up the email, find that it can't send it and then move it to sysmail_unsentitems and a number of the other sysmail tables for reporting purposes.
March 1, 2013 at 7:04 am
Erin,
Thank you for responding. I believe you are correct that DBMail is the service which actually sends the email.
Running msdb.dbo.sysmail_help_status_sp tell me the status of DBMail. It tells me its stopped. Attempting to send a test email fails - indicating the service is stopped. My question - how am I receiving emails?
Any comments / URLs are appreciated - thank you.
March 1, 2013 at 1:51 pm
Database Mail in SQL Server uses the Service Broker functionality. As mentioned before, the sp_send_dbmail command just queues up messages. As part of the service broker functionality, when an item is added to the queue, an activation procedure runs that ensures the external DB Mail program is running. You can see this process just like any other process running on your database:
select * from sys.dm_exec_sessions where program_name like 'DatabaseMail%'
When it is running, you'll probably see it wating with the wait type BROKER_RECEIVE_WAITFOR. It will naturally stop itself after a certain period of inactivity, don't remember exactly how long. But a new item put in the queue will ensure it starts up again.
Probably the best online documentation I've seen for it is:
http://www.yaldex.com/sql_server_tutorial_3/ch10lev1sec2.html
Here's the basic MSDN documentation which doesn't mention much about the service broker part of it:
http://msdn.microsoft.com/en-us/library/ms175887(v=SQL.105).aspx
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply