Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Getting Started with SQL Server Event Notifications Expand / Collapse
Author
Message
Posted Tuesday, December 22, 2009 12:08 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, October 20, 2014 3:10 PM
Points: 1,683, Visits: 1,797
Comments posted to this topic are about the item Getting Started with SQL Server Event Notifications

Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs
Post #837753
Posted Tuesday, December 22, 2009 6:02 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 11:44 AM
Points: 46, Visits: 341
Very nice work. Well written and very useful.
Thank you
Post #837860
Posted Tuesday, December 22, 2009 11:32 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 5:51 PM
Points: 17,845, Visits: 15,797
Nice Article



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Post #838112
Posted Tuesday, December 22, 2009 1:13 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 8:40 AM
Points: 378, Visits: 1,024
So if I want to implement this on another databases, I would have to create the stored procedure in each database and then sign the procedure with the cert correct?

Also if I am currently using db mail in other stored procedures will I have to sign the certificate to all of those as well for them to continue to work?
Post #838187
Posted Tuesday, December 22, 2009 2:25 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, October 20, 2014 5:54 AM
Points: 17, Visits: 348
You only need to set up the Event Notification for the database (or server). The stored procedure is only needed in the database where the queue resides. You could send the events to another database or even another server. Also, you are not required to use signed procedures.

I did a blog-post some time ago to catch deadlocks with event notification. This shows you how to handle server level events. Deadlock Alerts Trough Event Notification and doesn't use signed procedures.
Post #838265
Posted Tuesday, December 22, 2009 2:55 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, October 20, 2014 3:10 PM
Points: 1,683, Visits: 1,797
greggoble2 (12/22/2009)
So if I want to implement this on another databases, I would have to create the stored procedure in each database and then sign the procedure with the cert correct?

Also if I am currently using db mail in other stored procedures will I have to sign the certificate to all of those as well for them to continue to work?


Trace events are server scoped, so you don't need multiple Notifications per database for this. If you used DDL Events at the database level, it would have to be created per database, and to send email through queue activation from that database with DatabaseMail would require signing it with a certificate as the most secure method. I covered the purpose behind using certificate signing to access DatabaseMail from a non-msdb database on my article last week Using a Certificate Signed Stored Procedure to Execute sp_send_dbmail .



Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs
Post #838281
Posted Tuesday, December 22, 2009 3:00 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, October 20, 2014 3:10 PM
Points: 1,683, Visits: 1,797
Stan_Segers (12/22/2009)
You only need to set up the Event Notification for the database (or server). The stored procedure is only needed in the database where the queue resides. You could send the events to another database or even another server. Also, you are not required to use signed procedures.

I did a blog-post some time ago to catch deadlocks with event notification. This shows you how to handle server level events. Deadlock Alerts Trough Event Notification and doesn't use signed procedures.


You can create the server level items in msdb to get around the signed procedure but since that isn't a recommended practice, I don't offer ideas like that in online articles. It is one way to go about it though. I keep these kinds of things in DBA_DATA database on my servers personally, but everyone has their own methods.

This is the first in a series I have written on using Event Notifications and there is an article on capturing Deadlock Graphs pending publication, though I take things a bit further in my article than you did on your blog post by parsing the XML and retrieving additional information regarding the executing statements like their query plans which are important in deadlock analysis.


Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs
Post #838284
Posted Tuesday, December 22, 2009 3:40 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 8:40 AM
Points: 378, Visits: 1,024
Thanks for the info! Great stuff!
Post #838303
Posted Tuesday, December 22, 2009 4:45 PM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Thursday, October 23, 2014 9:17 AM
Points: 746, Visits: 559
Excellent article. Looking forward to more like it !!!!!
Post #838322
Posted Tuesday, December 22, 2009 10:05 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, January 3, 2010 9:36 PM
Points: 1, Visits: 4
I've copied the T-SQL from this article exactly and executed it. All works fine, but when I view the queue:

SELECT *
FROM EventNotificationQueue

there are no records. What am I doing wrong?

Post #838360
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse