Re: Pro*C Question: Forking Processes
Date: 1996/08/29
Message-ID: <504mbr$6hn_at_inet-nntp-gw-1.us.oracle.com>#1/1
In article <3225CDCE.167EB0E7_at_dkrz.de>, Frank-Michael Zimmer <zimmer_at_dkrz.de> writes:
|> Well, while I'm at it:
|>
|> I have a serious program with a Pro*C program that is to connect to the
|> database, and then fork via the unix system call.
|> Does anybody know what _exactly_ will happen, especially if one of the
|> processes terminates while the other one is to keep on running?
|> I have experienced the strangest effects, like pipes misteriously
|> refilling themselves, even if they have been emptied _before_ the fork,
|> and other strangenesses...
This can be summed up by one simple piece of advice:
Don't fork while connected to Oracle. Period.
If you do, you can get various problems, as you have observed. When you connect to Oracle, a shadow process is started. If you fork, then you have two user processes, one shadow process. Oracle doesn't expect this. The two userprocesses can interfere with each other very easily. If one exits, then the connection could be lost from the other. SQL statements from each could interfere with each other. Et cetera, et cetera. The simplest thing to do is disconnect, then fork, then have the parent and child each establish their own connections.
|>
|> Well, here's a problem to earn you the title "Oracle Guru"... ;)
|>
|> Thanks,
|> Frank-Michael Zimmer
Scott Urman Oracle Corporation surman_at_us.oracle.com
Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm
"The opinions expressed here are my own, and are not necessarily that of Oracle Corporation"
Received on Thu Aug 29 1996 - 00:00:00 CEST