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

Home -> Community -> Usenet -> c.d.o.misc -> Re: timer to terminate a long running process

Re: timer to terminate a long running process

From: Rod Corderey <Lane_Associates_at_compuserve.com>
Date: 1998/06/27
Message-ID: <3594E99F.4DC21776@compuserve.com>#1/1

Hi,

it all depends on what you are doing and how you are doing it.

Suppose you have a stored PLSQL procedure that is executing inserts and updates driven by a cursor. Then the procedure itself could either monitor it's total elapsed time at stages during its execution, eg each fetch of the driving cursor. It knows when it started so it can tell how long its been running. The run time at which it should stop could either be passed to it as an initial arquement, or if the process could quite normally be very long, then it could retrieve its current stop period from a control table.
Or the process could check for an alert via DBMS_ALERT for a call from another process to tell it to stop. The other process could be simply checking lapsed time in a loop, or be driven by someother criteria.

However the big question is not when you stop the process but how. In the above it's easy because the inserts/update/selects whatever are discrete pieces of a PLSQL process flow.

If the job was a single select statement or a single insert/update driven by a single select/where with no staged commits ie commit only at end, then you would have great difficulty in stopping the process tidyly programmaticaly.

Hope it's helpful

Rod Corderey
Lane Associates
Lane_Associates_at_Compuserve.com
http://www.Lane-Associates.com

dragon wrote:
>
> Is there a way in plsql or pro*c, preferably in plsql, to trigger a
> timer before running a database process? and if the process runs over
> the specified time limit I would like to stop the process gracefully
> and also set a warning flag in a table.
>
> In pro*c, I could use the timer function, but can I stop the long
> running process? Is there a similar function in plsql package that
> will do the same thing?
>
> It seems to me it has to be two-threaded, one for the process and the
> other for the monitoring timer.
>
> I'd appreciate any input or suggestions.
>
> --cs
  Received on Sat Jun 27 1998 - 00:00:00 CDT

Original text of this message

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