Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Send Email alert in case of database lock

Author  Topic 

jayanth_nadig
Starting Member

1 Post

Posted - 2008-08-28 : 02:42:24
i need to send email alert when the database is locked by one/more database connections, for more than a configured duration.

The following would be the criteria / sample scenarios where i need an alert:
a. More than 'x' number of (say, row-level) locks are held by a user request / SPID for 'y' minutes. The alert job could poll every 'z' minutes and keep track of which SPIDs are holding more than 'x' locks. For now, assume x is 1000, y is 5, z is 1. This way we would get an alert if an SPID held more than 1000 locks for more than 5 minutes.
b. 1 critical lock (e.g. database or table exclusive lock) is held for 'x' minutes. Even a single such lock could be trouble.

Please help me.

Thanks and Regards,

Jayanth

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-28 : 05:19:48
take a look at this for how to deal with deadlocks
http://weblogs.sqlteam.com/mladenp/archive/2008/07/18/Immediate-deadlock-notifications-without-changing-existing-code.aspx

take a look in books online for other events for other types of locking. that's one way to go...


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page
   

- Advertisement -