Create the trigger after modifying your mail profile settings, and any additional attachment types if you wish.
Simple technique to ensure you are informed if any content is written.
johnpressdee,
2017-03-03 (first published: 2017-02-21)
Create the trigger after modifying your mail profile settings, and any additional attachment types if you wish.
Simple technique to ensure you are informed if any content is written.
CREATE TRIGGER usr_suspect_page ON msdb.[dbo].[suspect_pages] FOR INSERT AS Begin exec msdb.dbo.sp_send_dbmail @profile_name = 'yourmailprofilename', @recipients = 'dba@mail.com', @subject = 'Suspect page row written - check details', @body_format='HTML', @query_result_header=1, @execute_query_database='model', @query = 'select * from msdb.[dbo].[suspect_pages]', @query_result_separator=' ', @attach_query_result_as_file = 0, --set to 1 for true, this script will keep results in email body @query_attachment_filename = 'msdb_suspect_rows.csv' -- will only attach when prior parameter set TRUE end
You rated this post out of 5. Change rating
Corrupt SQL Server databases are the worst nightmare of any SQL Server professional. In any environment, from small business to enterprise, the compromise of integrity and availability of the data can constitute a business emergency. This is especially the case in those organizations reliant on an OLTP data model, for a high-volume website. SQL Server database corruption and disruption of the transaction processing system can cause business repercussions such as large financial losses, a drop in reputation or customer retention, or contractual SLA problems with the service provider, if not managed in-house.
2013-02-18
3,385 reads
2016-02-10
1,344 reads
2014-12-02
1,596 reads
2011-08-18
2,107 reads
Ever restored a corrupted database from the backup, only to find that the backups are corrupted too - All the backups? Sure it can happen and it isn't nice when it does. To check that a database backup is internally consistent you have to use DBCC CheckDB. On a huge highly-loaded live system? Grant Fritchey has, as usual, a practical solution.
2011-05-02
3,896 reads