![]() Creating Database Mail Profile and Account Once all prerequisites are met, configure the database mail account and database mail profile. Once Database Mail is enabled, create a database mail profile and database mail account. To enable database mail, execute the following queries in sequence: USE masterĮXEC sp_configure 'show advanced options', 1 -Enable advance optionĮXEC sp_configure 'Database Mail XPs,' 1 -Enable database Mail optionĮXEC sp_configure 'show advanced options', 0 -Disabled advanced option Again, the Database Mail XPs parameter is an advanced option hence, before changing it, change the Show advanced option configuration parameter from 0 to 1. It must be enabled by changing the configuration value of Database Mail XPs from 0 to 1. By default, database email feature is not enabled. Once the service broker is enabled, and SQL Agent Service started, enable the database email by changing the database instance configuration parameter. Righ-click SQL Server Agent and select Start, as shown in the following image: In the list of services, search for SQL Server Agent. To start the SQL Server Agent service, open Services, go to Control Panel > Administration Tools > Services. If SQL Server agent service is not running, then we need to start it. use masterĮXEC xp_servicecontrol N'querystate',N'SQLAgent$CMS' To verify the status of agent service, execute following command in SQL Server management studio. While agent service is not running, all the messages will be queued, and when agent service starts, all queued messages will be delivered. If the agent services are not running, then SQL Server can not send emails. GO SQL Server Agent Service Must be Runningĭatabase Mail sends emails or messages using the SQL Server agent service. If the service broker on the MSDB database is disabled, execute following queries in sequence to enable the service broker: Use masterĪlter database set single_user with rollback immediateĪlter database set multi_user with rollback immediate WHEN is_broker_enabled = 1 THEN 'Service Broker is Enabled.' WHEN is_broker_enabled = 0 THEN 'Service Broker is disabled.' To verify that service broker is enabled, execute the following query: USE master If the service broker is disabled, the database mail cannot deliver the service broker messages and it remains in the service broker queue. SQL Server Agent service must be running.ĭatabase Mail requires service broker to queue emails. ![]() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |