All,
I set up an Alert for Message Id 19406 to be alerted whenever the Failover/FailBack on our AAG happens. I also setup an Alert for Message ID 1480 when a particular database's role changes. I need this Alert to work since I have to enable TRUSTWORTHY on some of the databases that are on the nodes (Secondary when the Failover happens and Primary when the Failback happens). I created this Alert by selecting the Database Name while configuring the Alert.
The Alert for MessageID 19406 fires as expected and we get a total of 12 alerts (per Failover & Failback). Unfortunately, the alert for Message ID 1480 does not seem to happen for the particular database. Instead I get one email for every database in the AAG.
I'm not sure if this is how it is supposed to work. I cannot even specify the database name in the Message Text area since I have more than one database for which I need to change the TRUSTWORTHY setting. I was hoping to run a Job via the Alert to enable the TRUSTWORTHY setting.
Please kindly share your experiences!!
Thanks.
rgn
USE [msdb] GO EXEC msdb.dbo.sp_update_alert @name=N'AvailabilityGroupRoleChange-1480', @message_id=1480, @severity=0, @enabled=0, @delay_between_responses=0, @include_event_description_in=1, @database_name=N'NorthWind', @notification_message=N'Database Role Changed', @event_description_keyword=N'', @performance_condition=N'', @wmi_namespace=N'', @wmi_query=N'', @job_id=N'00000000-0000-0000-0000-000000000000' GO EXEC msdb.dbo.sp_update_notification @alert_name=N'AvailabilityGroupRoleChange-1480', @operator_name=N'DBAsGroup', @notification_method = 1 GO EXEC msdb.dbo.sp_update_alert @name=N'AAG-StateChange-19406', @message_id=19406, @severity=0, @enabled=1, @delay_between_responses=0, @include_event_description_in=1, @database_name=N'', @notification_message=N'State of the AAG Changed. Failover/Failback is currently in progress', @event_description_keyword=N'', @performance_condition=N'', @wmi_namespace=N'', @wmi_query=N'', @job_id=N'00000000-0000-0000-0000-000000000000' GO EXEC msdb.dbo.sp_update_notification @alert_name=N'AAG-StateChange-19406', @operator_name=N'DBAsGroup', @notification_method = 1 GO