locking - Release another user's lock obtained with sp_getapplock on SQL Server -


we have system uses sp_getapplock create exclusive mutex time opens order in gui. used prevent multiple people making changes order simultaneously.

sometimes people open order , go home, leaving open. blocks being able make changes order. emails, calls , end doing kill <spid> in enterprise manager. i've gotten sick of , want make quick self-service webform.

the main problem i've run kill requires sysadmin privileges, not want give user our website runs as. have tried sp_releaseapplock doesn't let release user's lock (even when calling sysadmin).

so, question; know of alternative method release lock obtained user using sp_getapplock?

the documentation pretty clear on point:

locks placed on resource associated either current transaction or current session. locks associated current transaction released when transaction commits or rolls back. locks associated session released when session logged out. when server shuts down reason, locks released.

applocks analogous critical sections - primary reason existence other threads can't override them, unless have privileges kill process that's holding lock.

have considered using form of optimistic concurrency instead? applocks intended held less second @ time - i.e. duration of typical transaction. it's not idea hold onto 1 several minutes (or hours) precisely reason.

if must use applocks way, , can't use optimistic concurrency, believe recourse kill spid owns lock.

if don't want give sysadmin privileges user, create stored procedure kill process with execute <admin_user>... keeping in mind, of course, opens pretty wide security hole, careful grant execute permissions to.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -