Mark Harrison Mark Harrison - 9 months ago 62
SQL Question

How can a client cancel an active Oracle query?

I have an active Oracle operation which is taking too long. How can I programmatically cancel the operation without terminating the session?


The OCI library provides this functionality. The canonical example is a client pressing control-C during the long-running operation, getting control of the program back through the signal handler, and then cancelling the long-running operation.

Internally, the client will send an urgent message over the TCP connection, and the server side will process the termination via a SIGURG handler. The client operation will receive this status.

ORA-01013 ("user requested cancel of current operation")
  • C/C++:

OCIBreak() (at "Cancelling Calls")

  • Python (cx_Oracle):