Database Mail process shutting down

  • Hi Everyone

    I'm setting up maintenance jobs to backup data and to notify me. The Database mail service starts when I send a test message (and works ) but shuts doen after 10Minutes. Obviously no notifications.

     

    Any idea?

    Thanks

    Petrus

  • Has it ever sent a notification through a job within the 10 minutes you're referring to?

    Database mail is a 2 step process if you want it to be used to send notifications.  You first set up the database mail as you did.  Second you would modify the properties of the Sql Server Agent.  Select "Alert System" and then check "enable email profile".  Select "database mail" and the profile, then restart the SQL SERVER AGENT.

    After the agent comes up, you can test by creating a dummy job with one step and just have it "email operator whenever job completes".

  • Hello,

    I have set up my agent, setup operators, setup jobs and setup DB Mail.

    I can send tests as often as I like with no issue - how ever no jobs ever send notifications

    SQL 2005 sp2 is installed

    It did work for about a month back in February and since then I can get it going.

    Anyone that can help, Thanks

    Ian

     

  • Hi,

    I faced the same problem and could solve it with the following

    Went to Server Agent Properties, then Alert System, Enable Mail Profile "Database Mail".

    Then to History and checked on Delete job history.

    Stopped and Restarted SQL Server Agent and it worked.

    I hope this helps.

    Regards

    VaishaliHusain

  • Hi,

    Let me know if you were able to resolve this mail shut down issue, I am still f acing the problem and my issue resembles the same except that I am triggerring this job from a master server, the db is refrenced to the Target server.

    I have enabled the process the properties in SQLserver agent for profile and databases mail and had even restaretd the SQL services, aslo i did a change in the db mail configuration as to use Anonymous authentication. Still no use.

    Am back to ground1 now.

    Thanks

    Eben

  • In the object explorer, go to ...

    Management>>

    >>Database Email (right click)

    >>>>Click on "Configure Database Mail".

    >>>>>>Select "View or change system parameters"

    >>>>>>>>The "Database Mail Executable Lifetime (seconds)" is set at 600 seconds by default.

    (600 seconds / 60 second in a minute = 10 minutes)

    If you look at the Database Mail logs, you can see the service shuts down after ten minutes. I set this value at 43200 seconds which is equivalent to 24 hours.

    After changing this, I have never had another problem.

    To start the database mail after you have changed the settings, just send a test email by right-clicking on Database Email in the Management tab. When the test email is sent, it will auto-start the service. Keep on eye on the log for after ten minutes to ensure the service does not shut down again.

  • Old thread, I know, but I still went here in search for answers to this question.

    The majority of answers seem to indicate "a problem". I am not sure one exists, thus it doesn't matter to change the "Database Mail Executable Lifetime (seconds)", nor restarting SQL Server Agent as some proposes.

    I looked for answers because I set up a new SQL Server (2014), and now the mail log is dominated by these entries.

    I want to know why; and decide whether something is wrongly configured.

    Next, I dug out the mail log from our old SQL Server (2005). Same pattern. And I know for certain that this server sent out emails for years without anything going bad.

    Conclusion:

    If all you see is the log entries: Don't worry.

    If you have a problem with the SQL Server Agent notifying operators by email (or something similar), keep looking for wrong configurations - but it isn't due to the "Database Mail process shutting down after 10 minutes". Our jobs ran significantly longer than that. It is not the cause.

  • This is normal behavior, since database mail uses Service Broker, and queue, when you use sp_send_dbmail to send an e-mail, it gets put into a queue, which has an activation procedure on it. Service Broker ensures that the DB mail process will startup when needed.

    You can see a log of what DB mail actually did in the MSDB database:

    --messages not sent in past day

    SELECT * FROM dbo.sysmail_allitems

    WHERE sent_date > GETDATE() - 1

    AND sent_status <> 'sent'

    ORDER BY send_request_date DESC

    --error log past day

    SELECT i.mailitem_id, i.subject, i.send_request_date, l.log_date, i.body, i.file_attachments, l.description

    FROM dbo.sysmail_faileditems as i

    INNER JOIN dbo.sysmail_event_log AS l ON i.mailitem_id = l.mailitem_id

    WHERE i.last_mod_date > GETDATE() - 1

    ORDER BY i.send_request_date DESC, l.log_date DESC

    see:

    https://technet.microsoft.com/en-us/library/ms189635(v=sql.120).aspx

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply