Link to home
Start Free TrialLog in
Avatar of raichel
raichel

asked on

unix & oracle

hi all,
I need to nkow what is the most simply
way to know (from a java program),
if oracle server is installed on the machine (unix machine).
thanks Eran
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of howesd
howesd

The find approach might be a bit iffy - it can only search in directories which you've got permission to look in. If the executeable is in a directory you can look in, find won't find it.

Unfortunately, I haven't got any better ideas .......
Avatar of raichel

ASKER

come on!
u can do better!!!
:-)
you can check wheher there is a process listening on port 1521. but this won't work in all cases
You could try and load the oracle supplied JDBC driver; if it throws an exception, most likely ClassDefNotFound, the database probably isn't there ...

kind regards
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi

A long time ago I worked with Oracle on Unix.

To MaxMaxic's suggestion:
in oratab can be several "last"-lines (for every instance one line):
Dxyz:/usr/local/public/OraHome1:N
Txyz:/usr/local/public/OraHome1:N
Pxyz:/usr/local/public/OraHome1:Y
Exyz:/usr/local/public/OraHome1:N

The first field tells you the Instance-Name (* = all),
The second field tells you the home-directory of oracle
The third field tells you if the database-instance will be startet up at unix-startup (N=no, Y=yes).
So if you'll find there a "Y" then this will definitive be an oracle server installation. Otherwise you can still look for the directory MaxMaxic mentioned. - But on my client installations there was usually also a directory .../OraHome1/dbs.

The default value of the third field is "N". So if the database administrator did not modify this file, it gets a little bit triggy to figure out "server installation or not".

A running oracle you can find with "ps -ef | grep oracle"

I hope this helps also
chdba
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this
question is:

- split points between CEHJ and MaxMaxic

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer