Advertisements

SQL-BOX.COM

–SQL Server Storage

Always – ON Availability group Alerts

After setting up Always ON , we need to configure SQL server Alerts to know about the availability Group errors and other failover information you may want to know when occurred. Here is the list of error and scripts to create them.

You may don’t want to configure all alerts and flood inboxes when happened, you can choose which one to configure using below query,

SELECT message_id [error_number], severity, text
FROM sys.messages
WHERE text LIKE (‘%availability%’)
AND is_event_logged = 1;


Here is the Script to configure all alerts related to AG’s

————————————————————
— Always – ON HA Error Alerts
————————————————————

USE [msdb]
GO

/****** Object: Alert [HA Error – 35254] Script Date: 10/20/2014 1:55:32 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35254′,
@message_id=35254,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35262] Script Date: 10/20/2014 1:55:43 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35262′,
@message_id=35262,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35273] Script Date: 10/20/2014 1:56:01 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35273′,
@message_id=35273,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35274] Script Date: 10/20/2014 1:56:16 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35274′,
@message_id=35274,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35275] Script Date: 10/20/2014 1:56:34 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35275′,
@message_id=35275,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35276] Script Date: 10/20/2014 1:56:46 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35276′,
@message_id=35276,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35279] Script Date: 10/20/2014 1:57:03 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35279′,
@message_id=35279,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 35299] Script Date: 10/20/2014 1:57:23 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 35299′,
@message_id=35299,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41048] Script Date: 10/20/2014 1:57:38 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41048′,
@message_id=41048,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41049] Script Date: 10/20/2014 1:57:56 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41049′,
@message_id=41049,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41050] Script Date: 10/20/2014 1:58:13 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41050′,
@message_id=41050,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41051] Script Date: 10/20/2014 1:58:29 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41051′,
@message_id=41051,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41052] Script Date: 10/20/2014 1:58:43 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41052′,
@message_id=41052,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41053] Script Date: 10/20/2014 1:59:06 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41053′,
@message_id=41053,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41054] Script Date: 10/20/2014 1:59:21 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41054′,
@message_id=41054,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41055] Script Date: 10/20/2014 1:59:34 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41055′,
@message_id=41055,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [HA Error – 41089] Script Date: 10/20/2014 1:59:47 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’HA Error – 41089′,
@message_id=41089,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [AG Data Movement – Resumed] Script Date: 10/20/2014 2:13:37 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’AG Data Movement – Resumed’,
@message_id=35265,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [AG Data Movement – Suspended] Script Date: 10/20/2014 2:13:45 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’AG Data Movement – Suspended’,
@message_id=35264,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

/****** Object: Alert [AG Role Change] Script Date: 10/20/2014 2:13:51 PM ******/
EXEC msdb.dbo.sp_add_alert @name=N’AG Role Change’,
@message_id=1480,
@severity=0,
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=1,
@category_name=N'[Uncategorized]’,
@job_id=N’00000000-0000-0000-0000-000000000000′
GO

Make sure to enable e-mail operator for each alert after executing above script.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: