dbTalk Databases Forums  

How to ensure only one process accesses a record in Oracle database table

comp.databases.oracle.server comp.databases.oracle.server


Discuss How to ensure only one process accesses a record in Oracle database table in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Srini
 
Posts: n/a

Default How to ensure only one process accesses a record in Oracle database table - 10-12-2004 , 02:27 AM






We have multiple processes running in parallel accessing the same
database table in Oracle. The processes access the table thru a
trigger and a stored procedure written for the trigger.

We want only one process to pick a record and update it with a status.

Is it possible to lock a record in Oracle ? Can any one tell me how we
can achieve this?

Thanks,
Srini

Reply With Quote
  #2  
Old   
Sybrand Bakker
 
Posts: n/a

Default Re: How to ensure only one process accesses a record in Oracle database table - 10-12-2004 , 04:27 AM






On 12 Oct 2004 00:27:46 -0700, aone1504 (AT) yahoo (DOT) com (Srini) wrote:

Quote:
We have multiple processes running in parallel accessing the same
database table in Oracle. The processes access the table thru a
trigger and a stored procedure written for the trigger.

We want only one process to pick a record and update it with a status.

Is it possible to lock a record in Oracle ? Can any one tell me how we
can achieve this?

Thanks,
Srini

Records are automatically locked.
You seem to need a table level lock, consequently severely limiting
the scalability of your application. You can lock a table by issuing
the lock table statement, in your case in exclusive mode.
Note: this will not prevent records to be read.


--
Sybrand Bakker, Senior Oracle DBA


Reply With Quote
  #3  
Old   
Hans Forbrich
 
Posts: n/a

Default Re: How to ensure only one process accesses a record in Oracle database table - 10-12-2004 , 08:15 AM



Srini wrote:

Quote:
We have multiple processes running in parallel accessing the same
database table in Oracle. The processes access the table thru a
trigger and a stored procedure written for the trigger.

We want only one process to pick a record and update it with a status.

Is it possible to lock a record in Oracle ? Can any one tell me how we
can achieve this?

Note that Oracle only locks one row. Readers don't block writers, writers
don't block readers.

Cursors, together with SELECT ... FOR UPDATE & UPDATE ... WHERE CURRENT OF
might help.

You can create brand new 'named' locks and interrogate those. Check out
DBMS_LOCK package and it's documentation in the SUpplied PL/SQL Packages
and Procedures.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.