Sql-server – How does one create a notification upon corruption being found during Automatic Page Repair under database mirroring

corruptionsql server

I read: https://msdn.microsoft.com/en-us/library/bb677167(v=sql.120).aspx#UnrepairablePageTypes

But, I am unclear how I can set up a notification so I am aware when this occurs.

Any advice?

Best Answer

Assuming you are on any edition besides express AND that you have SQL Agent enabled/running, the quickest route is to utilize Glenn Berry's alerts setup script, to configure all of the necessary parts for alerting on most of the IO related alerts (823, 824 and 825). 823 and 824 are specific to an actual IO corruption, while 825 is a lesser used warning sign of a potential storage problem (retry).

In addition to Glenn's base alerts, add an alert for error 829 (Page marked RestorePending) and error 1481 (Database mirroring could not repair physical page). These will likely fire with corresponding 823 or 824 errors), but are mirroring/AG specific in context.

Also note, that you can historically view pages that were marked suspect/corrupt, by querying the suspect_pages table in msdb, as opposed to scanning the ERRORLOG for errors.