Finding all Oracle SW installations on a host


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding all Oracle SW installations on a host
# 1  
Old 12-31-2016
Finding all Oracle SW installations on a host

Hi. I'm trying to find the best way to locate the latest version of Oracle on a Linux host.

There could be multiple SW installs or there could be none. It could be a client or a full RDBMS installation. I need to find and set the environment in order to run the sqlplus binary. Rather than just running a find command, is there a smarter way? Many thanks.

---------- Post updated at 10:34 PM ---------- Previous update was at 09:58 PM ----------

Up until now I've used this command:

Code:
SQLPLUS_BINARY=$(find /u01 -name sqlplus -type f 2>/dev/null | sort -n | sed -n 1p)

but there must be a more elegant way to do this.
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 01-01-2017 at 01:34 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 01-01-2017
If there are multiple installs, you might start with querying the package manager. For APT, try dpkg -l, perhaps piped into a grep -i ORACLE or similar / adequate keywords.
# 3  
Old 01-01-2017
Oracle has a tool - $ORACLE_HOME/bin.tnsping. You should have it installed on your desktop machine if you have an oracle client install.

This will tell you if you connect to a server on a remote host - i.e., does one exist and is it up. sqlplus binary exists on any box that has either the client software set or the server software set. So, locating sqlplus in each $ORACLE_HOME on a machine tells you the instance name(s). e.g., /u01/blah/blah/bin/sqlplus , plus it shows the version as well.

If you want to connect to every server you can (you need passwords and usernames) see, you should consider having all of the versions like 9, 10, 11 client installed on the box doing the searching.
# 4  
Old 01-01-2017
I should've mentioned that I won't know the $ORACLE_HOME setting. There may actually be no Oracle SW on there. It's a Linux VM and the script won't be run as the oracle user. I need to work out the ORACLE_HOME from scratch on whichever host the script is run on. Connecting to a DB afterwards is straightforward. But how can my script determine the correct HOME? I think I need to check the Oracle Inventory ... oraInst.loc

---------- Post updated at 12:17 PM ---------- Previous update was at 10:57 AM ----------

This command will list all Oracle inventory files:
Code:
locate oraInst.loc


Last edited by user052009; 01-01-2017 at 01:33 PM..
# 5  
Old 01-02-2017
You could simply use the id command. If oracle is installed on a UNIX box, that box has an oracle user id, unless someone did something against oracle installation instructions.
Code:
while read remote
do
   echo "$remote"
   ssh user@$remote 'id oracle &&  locate oraInst.loc  || echo "not OK" '
done < list_of_servers.txt  > report.txt

# 6  
Old 01-02-2017
Thanks for that. Trouble is, there will definitely be an Oracle account on the host but there may be no Oracle SW installed.

In the cases where the SW is installed, more than likely there will multiple SW installations and the 'locate' cmd will return many records. I'd need to know which is the latest valid installation and an actual RDBMS or client installation ... there could also be some Oracle SW plugin entries.

I'm only interested in checking the local host (it's part of a script that gets rolled out there), so I won't be looping through a server list. I can use the find command mentioned earlier and just check the timestamps of the multiple sqlplus binaries. Was just hoping there was a more elegant way to do it.
# 7  
Old 01-02-2017
I haven't had a system with more than one database running for some times (virtualisation does that to a system) but you might look at the file /etc/oratab for the relevant information. It should tell you exactly what you want.

I hope this helps.

bakunin

PS: ˇNo pasarán!

Last edited by bakunin; 01-02-2017 at 08:13 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding Oracle form Version UNIX

I'm trying to find the version of the underlying Oracle forms from out Unix Server. I have tried frmcmp.sh -h but I get the error frmcmp.sh -h : not found Its a Unix Sun server running an oracle database Any ideas? (1 Reply)
Discussion started by: dbajtr
1 Replies

2. Shell Programming and Scripting

Connect to Oracle in Windows XP from Linux HOST

Hi everyone, I have oracle 9i installed in Windows XP and i have ubuntu in VM WARE. I would like to know how to connect to Oracle in windows xp from Linux through shel scripting...... (3 Replies)
Discussion started by: Zimbu
3 Replies

3. Programming

Oracle accessing from remote host

i have installd oracle 10 on Solaris 10 now i want to access this database from remote machine. -bash-3.00$ tnsping 192.168.92.49 TNS Ping Utility for Solaris: Version 10.2.0.2.0 - Production on 17-DEC-2010 21:06:51 Copyright (c) 1997, 2005, Oracle. All rights reserved. Used parameter... (23 Replies)
Discussion started by: akhaliq22
23 Replies

4. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

5. Solaris

Packages installations on my servor

Hello everybody, I'd like to install several important packages on my servor like for instance, man pages package.. I found a .tar.gz package of man pages. So, after to do "gtar zxvf name_of_file.tar.gz" I can access on the folder "name_of_file" (by cd name_of_file). Then, I read on my readme... (4 Replies)
Discussion started by: MasterapocA
4 Replies

6. HP-UX

Multiple Perl installations on HP-UX

This will undoubtedly seem like a problem that should be easily resolved but... We are having some 'issues' getting multiple versions of Perl installed on our HP-UX servers (11.11 & 11.23). Now, I'm not a Sys Admin but I believe the reason behind this is that the Perl installation which comes... (2 Replies)
Discussion started by: Macer
2 Replies

7. Linux

external dvdrw installations

Hello all, Please can someone assist? I am attempting to install an external dvdrw on fedora 6. I attach the dvdrw device to the USB port and run dmesg: scsi2 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 4 usb-storage: waiting for device to settle before... (0 Replies)
Discussion started by: chlawren
0 Replies

8. Solaris

Network Installations of Solaris

First off, I'm pretty new to Solaris, although I know Windows very well. I have a mixed Wintel, Linux and SPARC/Solaris environment and am looknig for a way to make short work of installing Solaris. I know there is a network booting option and there are the WebStart (configurable) and JumpStart... (1 Reply)
Discussion started by: BeekerC
1 Replies

9. IP Networking

QNX host cannot ping SCO host, vice versa

The problem I am facing now is that the QNX host could not ping the SCO host and vice versa. They are in the same domain, ie, 172.20.3.xx. As I am very new to Unix, I guess I must have missed out some important steps. Pls help... Thanx alot (2 Replies)
Discussion started by: gavon
2 Replies
Login or Register to Ask a Question