If you run a very long running Oracle query from AOLserver (maybe
because you made a mistake in your SQL), and then kill AOLserver, the
Oracle query will continue to run inside Oracle. The fact that the
Oracle client program (AOLserver) no longer exists makes no
difference. (At least, that's always the way it's worked on all the
Oracle 8i installations I've seen.)
Incidentally, what is PostgreSQL's behavior in this case?
To actually stop the query from running, you can either find the
Oracle session with the runaway query and kill it with
"alter system kill session 'SID,SERIAL#';
",
or you can find the Oracle unix process handling the now-defunct
client (assuming you are not running Oracle MTS, of course), and kill
that process with "kill PID
".
Simply killing the Oracle process from the unix command line seems to
work, and I suspect it is safe, but does anyone know for sure if it
will always be safe? It is certainly simpler, so is there
any reason to prefer the more complicated "alter system kill session
..." method?
If killing the Oracle process is always safe, then it might be a good
idea to have the restart-aolserver
script kill not only
the AOLserver process, but any Oracle processes which are children of
the AOLserver process. This would automatically kill all runaway
queries when AOLserver is restarted. Has anyone tried this?
Alternately, if you're connecting to Oracle over Net8, you can add
sqlnet.expire_time = 5
to "$ORACLE_HOME/network/admin/sqlnet.ora
",
which should tell Oracle to check every 5 minutes that the client is
still connected, and kill the session of the client is gone. That
sounds useful, although I haven't tried that yet. Also, it definitely
won't wory for Bequeath Oracle connections, only Net8. Anyone used
this before? How well has it worked for you? E.g., any problems with
it wrongly killing a connection because of some transient network
snafu?
In general, how have people here handled this "runaway Oracle query"
problem? One of these methods above, or something different? I'm
interested in you're experiences, for better or worse.