Recentemente em um projeto que eu atuei como DBA SQL Server me deparei com a necessidade de configurar um database mail com um script para alertas de jobs que falharam na instância, como jobs de backups. Então eu utilizei o script abaixo.
USE master GO --Ativando o database mail EXEC sys.sp_configure N'Database Mail XPs', N'1' GO RECONFIGURE WITH OVERRIDE GO DECLARE @ServerIPAddress varchar(25) = '1.1.1.1' --use SET for previous versions para versões anteriores --SELECT @ServerIPAddress = [value] FROM MyDB.dbo.configurations WHERE [name] = 'ServerIP' -- Criando a conta do database mail EXEC msdb.dbo.sysmail_add_account_sp @account_name = 'Conta de alertas de Jobs', @email_address = '<a href="mailto:email@seudominio.com">email@seudominio.com</a>', @display_name = @ServerIPAddress, @replyto_address = '<a href="mailto:DBAS@seudominio.com">DBAS@seudominio.com</a>', @description = 'SQL Server Job Alerts Account', @mailserver_name = 'smtp.seudominio.com' GO -- Criando o database Profile EXEC msdb.dbo.sysmail_add_profile_sp @profile_name=N'Alertas de jobs do Profile', @description=N'SQL Server Alertas de jobs do Profile' GO -- Adicionando a conta ao profile EXEC msdb.dbo.sysmail_add_profileaccount_sp @profile_name=N'Alertas de jobs do Profile', @account_name=N'Conta de alertas de Jobs', @sequence_number=1 GO --Tornar o profile para public (padrão) EXEC msdb.dbo.sysmail_add_principalprofile_sp @principal_name=N'guest', @profile_name=N'Alertas de jobs do Profile', @is_default=1 GO
Algumas alterações de domínios e ip serão necessárias para que funcione corretamente no seu ambiente.
Blackjack, additionally known as twenty-one, is just one of one of the most popular gambling…
If you are a fan of online gambling, then you must have come across gry…
On the internet online casinos have transformed the betting industry, enabling players to vegas.hu online…
Casinos online offer free spins to draw new customers. These bonuses are usually very profitable,…
In recent times, online casino sites have actually obtained enormous appeal among gamers, providing a…
Bitcoin, the most preferred cryptocurrency worldwide, has reinvented lots of industries, including the on baixar…