How to execute a lock timeout?

Question:

How do I place or execute a Lock Timeout within the database of 30 minutes?  Is this possible?  Any information that you can provide will be helpful.

Answer:

Some options -

1) dbms_lock package allows lock timeouts - but you have to have your
application built around this.

2) When trying to lock records, have some code like:

loop
  begin
    (try and lock rows with NOWAIT clause)
     exit;
  exception when others then
     if sqlcode = -54 (I think) then
        if no_of_attempts > 30 then
           raise;
        else
           no_of_attempts := no_of_attempts + 1
          dbms_lock.sleep(60);
        end if;
     end if;
  end;
end;
(lock has been obtained - proceed as per normal)

3) Create a loopback database link and take advantage of
distributed_lock_timeout.

HTH
--
===========================================
Connor McDonald
http://www.oracledba.co.uk
 
 

Hosted by www.Geocities.ws

1