[comp.databases] Cancelling a query in Oracle on Unix

bonnett@seismo.CSS.GOV (H. David Bonnett) (03/23/91)

We are looking for a way to cancel a query that is in
progress from within a Pro*C application. It is quite 
possible for our users to cobble up a query that will
not finish for many moons and we want to be able
to kill these off.  We are using the two-task driver
on TCP-IP on Sun 4's with Oracle v6.0.27.8.1.

Some poking around has unearthed the following:
1.) The tcp-ip drivers provides for in/out of band
  breaks; implying that a methods exists at this 
  level.
2.) SQL/PLUS is able to notify the back-end that
   the query is not needed any more.
3.) The back-end does keep running until the query
   completes when called from Pro*C.
4.) Not a word about this appears in all the manuals
  I looked through (DBA, Pro*C, Tcp-Ip, Unix Tech Ref
  etc); although there Is a nice chart on the "Evolution
  of Unix" ;-)

Any pointers or ideas are greatly appreciated

-dave bonnett-   Center for Seismic Studies;  Arlington, VA 
      bonnett@seismo.css.gov :  All standard disclaimers apply.




--
-dave bonnett-   Center for Seismic Studies;  Arlington, VA 
      bonnett@seismo.css.gov :  All standard disclaimers apply.

tdoyle@cim-vax.honeywell.com (03/23/91)

In article <49507@seismo.CSS.GOV>, bonnett@seismo.CSS.GOV (H. David Bonnett) writes:
> 
> We are looking for a way to cancel a query that is in
> progress from within a Pro*C application. It is quite 
> possible for our users to cobble up a query that will
> not finish for many moons and we want to be able
> to kill these off.  We are using the two-task driver
> on TCP-IP on Sun 4's with Oracle v6.0.27.8.1.
> 

How about simply sending a terminate signal to the process. On Systen V
Unix it would be:
      kill -15 <pid>
    or a more rude
      kill -9  <pid>

Bipin Prasad   bprasad@honcim1.honeywell.com

cjackso@uswnvg.UUCP (Clay Jackson) (03/27/91)

We had the same problem here, on a Pyramid, with bunches of clients.
Basically, what you need to do is be sure that the signalling gets
done correctly.  

In your IUG there should be some pages that talk
about signal handling and Oracle.  Oracle uses some signals (I forget
which off the top of my head, but it's documented in TFM) to 
communicate between the client and the server processes (this is true
even in the case where you're using either the Pipe or Fast drivers
as opposed to some network driver.

Anyway, to make things stop, the client process should be sent a 
SIGINT. Once the client sees this, it will send other stuff 'down the
line' to the oracle background process, and things will eventually
wind down.  Exactly how long this takes is a function of a number of
things, including how much work the server is doing (ie, how busy is
PMON). If you'rn impatient, you can send a 'kill -ALRM' to the PMON
process, which will sometimes speed things along.  

DO NOT, under any except the most dire circumstances take matters into
your own hands and start doing 'kill's, you'll wind up with all sorts
of zombies.

Good luck!

Clay Jackson