17.07.2015 Views

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9 – Honeycombing a DatabaseCreating an Alert for NotificationOnce the operator has been created, we are ready to create our Alert. An Alertmonitors the database for events. When an event occurs, a notification is sent tothe Operators that are assigned to the Alert.Alerts are dependent upon the SQL Server Agent, which must be running. Ifthe SQL Server Agent is not running when an Alert is created, a message willbe presented stating that it is not running and that the Alert will not function.We can create alerts using the sp_add_alert system stored procedure,example syntax for which is as follows:sp_add_alert [Alert Name],[Message ID],[Severity],[Enabled],[Delay Between Responses],[Notification Message],[Include Event Description In],[Database Name],[Event Description Keyword],[Job ID],[Job Name],[Raise SNMP Trap],[Performance Condition],[Category Name],[WMI Namespace], [WMI Query]This system stored procedure's arguments are as follows:• Alert Name – the textual reference to the Alert.• Message ID – the value that identifies the message that is sent. Inour case, our messages from the Server Audit are being captured in theWindows Application Log; therefore we can use the Error ID that isfound in the sysmessages system table.• Severity – the value that indicates the severity of the message sent.If the Message ID is used, this value must be 0.• Enabled – indicates whether the Alert is active.• Delay Between Responses – indicates the wait time for anotification to be sent after a previous notification. The value of 0indicates that there is no delay.• Notification Message – additional text that is sent with theevent message. This is optional.• Include Event Description In – identifies where the SQLServer event message should be provided. A value of 0 indicates thatthe SQL Server event message is not to be sent. A value of 1 indicatesthat it should be included in an e-mail. The other options that are196

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!