Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

  (email not shown publicly)

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Thursday July 26, 2007
03:07 PM

Cleanly logging out of Oracle in an emergency

[ #33891 ]

I've got a set of programs that explicitly secure a certain type of lock in Oracle and then perform a certain process. Sometimes these programs die unexpectedly. When they do, the client process dies, but there is a server process within the Oracle instance itself that stays up because it is still holding that lock. The server process is apparently incapable of detecting that the client has died. It won't detect it until something I'm not sure of happens ... something that won't happen because the client is now not around to make it happen.

So, I need to catch every possible signal that might make these client processes die and have them attempt to release that lock if at all possible before dying.

Oh, and I have to do it in Java.

The reason I'm here writing about it is I was going to ask if anyone knew how to do this. (The reason I'm here and not on a Java site is because Perl programmers are smarter than Java programmers, and of course because I am always here and don't seem to derive enough benefit to going elsewhere to justify it. :) ) Then I realized noone will know what the locking mechanism is that I am talking about. Then I realized that the problem is that I don't understand these locks, and that if I did the rest of it would be a simple exercise in looking up Java and PL/SQL syntax. In trying to explain my question above, I actually outlined the solution. All this has done is serve to focus my thoughts. :)

So I guess now I just need to go read about it. Thanks, guys. You're great. :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Where should I send the bill?
  • One of the signals that can kill the Java program is a kill -9. Which can't be caught. Ever.

    If your sysadmins are being happy with kill -9, then what you may need to do is write a monitoring process which is told what each Java process is doing, and will tell Oracle to clean up after them when they disappear without properly cleaning up.

    Another possibility is that the bug is in Oracle. Unlikely I know, but back in the Oracle 8 series I ran across a query that caused an internal Oracle process to try to f
    • Yeah, that's why I said "catch all signals possible." :)

      Part of the issue is actually that I myself and one of our monitoring groups have to kill this every so often, although I definitely don't kill with 9 unless something refuses to go away with something weaker.

      I'm not sure a second process could tell Oracle to release these locks, because it wouldn't own them. So I'm not sure the monitoring process idea will work. It might be possible, however, for an audit process to run on the server side and ki

      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
      • You'll have to work with a DBA on how to do it, but it is possible for a second process with sufficient privileges to kill someone else's login on the Oracle side. When that login is killed, all locks that it held are released.

        This does take a lot of work to set up though. I wouldn't go there unless you really have to. But be aware that it is an option.