Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: RE: Has anyone done any scalability work on dbms_lock?

Re: RE: Has anyone done any scalability work on dbms_lock?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 22 Jan 2004 09:09:25 -0800
Message-ID: <F001.005DDE6A.20040122090925@fatcity.com>

I came across a very nice example a while ago where there were 4 concurrent sessions feeding data into a holding table, and one session consuming from the table.

The rules said that the consumer could not run while the producers were loading the table, but multiple producers were allowed to run.

It was easy to implement using dbms_lock - the producers ran a pl/sql loop that requested a share lock (mode 4) on a named resource, and committed at the end of each loop; the consumer also ran a loop but requested an exclusive lock (mode 6) on the same named resource and committed at the end of each loop.

Both programs had a little sleep time built in to the loops after the commit.

When the consumer got its lock, the producers waited. When the consumer committed, the producers got in, and the the consumer queued on them when it next asked for its lock.

Regards

Jonathan Lewis
http://www.jlcomp.demon.co.uk

  The educated person is not the person
  who can answer the questions, but the
  person who can question the answers -- T. Schick Jr

Next public appearances:
 Jan 29th 2004 UKOUG Unix SIG - v$ and x$  March 2004 Hotsos Symposium - The Burden of Proof  March 2004 Charlotte NC OUG - CBO Tutorial  April 2004 Iceland

One-day tutorials:
http://www.jlcomp.demon.co.uk/tutorial.html

Three-day seminar:
see http://www.jlcomp.demon.co.uk/seminar.html ____UK___February

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

> Well, I don't know about anyone else, but I make use of it to synchronize
data upload programs for our testers. Can't have two instances of the upload program processing the same tester, they'd duplicate data. Anyhow, we normally run 4 instances of this program & the dbms_lock package works absolutely fantastically.
>
> Dick Goulet
> Senior Oracle DBA
> Oracle Certified 8i DBA

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Lewis
  INET: jonathan_at_jlcomp.demon.co.uk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Jan 22 2004 - 11:09:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US