General
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically killing looping _orasrv process

SOLVED
Go to solution
Ian Dennison_1
Honored Contributor

Automatically killing looping _orasrv process

Greetings all,

Have a PHB who wants me to write a script to automatically kill off a "_orasrv" process which has utilised more than [X]% CPU, as its "obviously looping" at that point.

Any idea how I can convince him otherwise without the use of firearms? Has anyone ever effectively monitored oracle server process for loop conditions?

Share and Enjoy! Ian
Building a dumber user
6 REPLIES
Steven Schweda
Honored Contributor
Solution

Re: Automatically killing looping _orasrv process

It's probably hopeless, but you might try
asking how to tell the difference between a
process using X% of the CPU productively,
and a process wasting X% of the CPU. It's
hard to automate a procedure which can't be
defined.

A debugger might let you trace the program
execution, but how to distinguish a useful
loop from a useless loop might still be
difficult.

Or, you could just write a procedure to look
at, say, "top" output, and whack the thing
when it gets high. Then wait for the
complaints to roll in.
Bill Hassell
Honored Contributor

Re: Automatically killing looping _orasrv process

If Oracle is looping then a very bad thing to do is to kill it -- you will likely corrupt the database. It is trivial to create very bad SQL code that will cause Oracle to consume CPU cycles. Is it in a meaningless loop? No. It is doing what it was told to do. If the data is worthless, then by all means, kill off processes that take too much time. But how do you define "too much time"? Then plan on how to restore the corrupted database files.

It is impossible to determine that Oracle is in an endless loop without Oracle debug tools.


Bill Hassell, sysadmin
OldSchool
Honored Contributor

Re: Automatically killing looping _orasrv process

usual suggestion for such situations is

1) get it in writing
2) respond that this is a bad idea, for all the reasons noted. copy dba (if other than PHB)

if forced:
3) implement, preferably kill -9
4) arrange to go on vacation...

watch the fun insue.

BTW: I really don't recommend the above, but....
James R. Ferguson
Acclaimed Contributor

Re: Automatically killing looping _orasrv process

Hi Ian:

For your sake, if you are forced into a 'kill', do so with increasing prejudice. Begin with a 'kill -hup'; escalate to a 'kill -term' [the default]; and only as a *last* restort, use 'kill -9'. You certainly don't want orphaned shared memory segments lingering around because you didn't give your process a chance to cleanup.

This all aside, Bill's comments are very germane.

Regards!

...JRF...
Ian Dennison_1
Honored Contributor

Re: Automatically killing looping _orasrv process

Thanks everyone for their feedback. I will definitely get it in writing and include the escalating "kill" values. "Holiday" - whats that?

Share and enjoy! Ian
Building a dumber user
Dennis Handly
Acclaimed Contributor

Re: Automatically killing looping _orasrv process

You could also renice the process so it still runs but others can get the CPU: renice -n 20 PID