Oracle global lock across process

Posted by Jimm on Stack Overflow See other posts from Stack Overflow or by Jimm
Published on 2010-03-26T19:48:35Z Indexed on 2010/03/26 19:53 UTC
Read the original article Hit count: 312

I would like to synchronize access to a particular insert. Hence, if multiple applications execute this "one" insert, the inserts should happen one at a time. The reason behind synchronization is that there should only be ONE instance of this entity. If multiple applications try to insert the same entity,only one should succeed and others should fail. One option considered was to create a composite unique key, that would uniquely identify the entity and rely on unique constraint. For some reasons, the dba department rejected this idea. Other option that came to my mind was to create a stored proc for the insert and if the stored proc can obtain a global lock, then multiple applications invoking the same stored proc, though in their seperate database sessions, it is expected that the stored proc can obtain a global lock and hence serialize the inserts. My question is it possible to for a stored proc in oracle version 10/11, to obtain such a lock and any pointers to documentation would be helpful.

© Stack Overflow or respective owner

Related posts about oracle10g

Related posts about oracle11g