From: <mh_at_pixar.com>
Date: 08 Aug 2009 10:53:20 GMT
Message-ID: <4a7d5920$0$1465$586efd2_at_news.usenetserver.com>

I have a server program that should run in active/standby mode:
  • a copy of the program is running on two different computers
  • only one copy should be active
  • if the active copy exits, fails, etc, the standby should take over and become the active
  • when the original active resumes, it is now the standby

Using a dbms_lock makes this quite simple, put this code at the top of the program:

    dbms_lock.allocate_unique('myserver', v_lockhandle);     v_result := dbms_lock.request(v_lockhandle, dbms_lock.x_mode);

  1. Is there any problem with holding a lock for a long time? The active may stay active for months on end.
  2. If there is a problem with holding a lock for a long time, what is a "reasonable" time to keep a lock open?
  3. The most common way this lock will be released is for the process or the computer to die. Are there any problems related to this?

Many TIA,

Mark Harrison
Pixar Animation Studios
Received on Sat Aug 08 2009 - 05:53:20 CDT

Original text of this message