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
# 8  
Old 01-03-2017
Thanks for the response. It's possible that there won't be any running databases or Oracle SW so there's no guarantee an oratab file will exist. All sqlplus connections will be to remote DBs.

To be fair it's an awkward question as there are many ways to get the result but not all of these methods are 100% portable between hosts with differing setups and SW versions. They're not error proof. I just thought perhaps somebody may have encountered this before and developed a script that scans an entire host (as a user other than oracle) and finds the latest Oracle RDBMS/Client install regardless of which directory tree (ORACLE_HOME) it's in or the naming convention used for that home.
# 9  
Old 01-03-2017
You can cat the /etc/oraInst.loc file to find the primary Oracle inventory. For me its the /home/oracle/oraInventory directory. Then look at the /home/oracle/oraInventory/ContentsXML/inventory.xml file. As the name suggests it is an xml file. Grep for the following:

Code:
 grep "HOME NAME" /home/oracle/oraInventory/ContentsXML/inventory.xml | sort -u

The problem with looking at the /etc/oraInst.loc is that you can have more than one inventory location. You can have Oracle running as more than one user. But you should not have either situation. It should be easy for any DBA to look at your server and know what Oracle homes are being used and which database uses which Oracle home. You can also look at the /etc/oratab file. Which should be the file of record for what database runs from what home.
# 10  
Old 01-03-2017
Yes, absolutely, that's one of the methods - to check that xml file but (once you find the correct xml file) there are multiple homes in there. And to a DBA it's obvious but this has to be handled automatically by the script so it takes a clever bit of code to determine the correct one. Remember that file and those homes will differ from system to system. That's why I went with searching for the newest sqlplus binary originally. It works but it's not elegant. I'm sure there's a better way to do it.
# 11  
Old 01-04-2017
Why doesn't your /etc/oratab file reflect every database running on a server and which Oracle Home that database uses? When I log in to a server I have my .bashrc script run the following commands.

Code:
export DEFAULT_SID=`grep -v "^$" /etc/oratab | grep -v "^#" | grep -v "^\*" | head -1 | cut -d":" -f1`
. ${HOME}/scripts/bin/set_oracle_env.sh ${DEFAULT_SID}

The set_oracle_env.sh script set the ORACLE_HOME, PATH, LD_LIBRARY_PATH, TNS_ADMIN which is in /etc, and the ORACLE_SID. You can write your own and have it set anything that you want. I also create the following alias's for my convenience.

Code:
alias getenv="env | egrep 'ORACLE|TNS' | sort"
alias setenv=". ${HOME}/scripts/bin/set_oracle_env.sh "
alias sqlsys="cd ${HOME}/scripts/sql ; sqlplus '/as sysdba'"

Then setting my environment is dead simple. Especially with writing scripts where I start with the set_oracle_env.sh script to set the Oracle environment variables.
# 12  
Old 01-04-2017
Thanks for the reply Gandolf.
In answer to your first question ... it's because it's not a database server. It's an application server. There won't be any DBs running there. I'm just connecting from there to a remote DB host (as a non Oracle user). There may not be any Oracle client or RDBMS SW installed at all locally which I have to factor in as well.
# 13  
Old 01-04-2017
Perhaps you could use a tool like nmap to walk around your network looking for port 1521 being open, the default for the TNS listener. You could then explore the listener on each server you find with (I think)
Code:
lsnrctrl status

Be aware that nmap can be a heavy impact tool on the network so you should try to target it. Of course, if you know the server, then forget about nmap and have a look at the output from the listener. It might give you version information in there, depending how you have installed it.

Additionally, you could look in /etc/oratab for clues.

It's probably a bit late for installation advice, but directing the installer to use a sensible path name with the version in it is very useful. I have three versions of the full RDBMS installed on the same server. They are in:-
  • /u09/home/oracle/software/7.3.3
  • /u09/home/oracle/software/8.1.7.4
  • /u09/home/oracle/software/11G.1.1
Can you guess the versions? Yes, I know they're old! Smilie


We have a set of environment scripts in the PATH under /usr/local/scripts/env which we can just source into the current shell. After login, you can just run your choice of (note the preceding dot space):-
  • . unidevda
  • . unidevdb
  • . unidevdc
  • etc.

Each one of these will set up the environment as requested including ORACLE_HOME, application software version, application home, scripts directory etc., in fact anything you want. People soon get very used to signing on and sourcing the environment. You can even add them into match scripts, if that is appropriate.


Have I helped or missed the point entirely?

Robin
# 14  
Old 01-04-2017
Thanks Robin. All responses are very welcome.

To summarise quickly - imagine a script that is rolled out to a linux host that is not a database server. The script is run as user root. There are no DBs running there and there's no oratab. There could be client and/or RDBMS software installed or there could be no Oracle SW at all. There's no way of knowing beforehand as it's an automated process. I need to find the latest working version of any valid Oracle SW in order to set ORACLE_HOME so I can connect to a DB on a remote host.

There could be multiple oracle inventory files with multiple homes listed in each one and the locations could be anywhere ... in any directory tree. It's basically a search on a completely unknown host.
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