4

I need to determine from a program what version of Oracle is installed in each of the Oracle Homes on a server. As there may not be any databases created in the Home yet, I need to be able to do this outside of the database (i.e., without connecting to the database). Also, it would be highly preferable to be able to do this from a remote program.

This is from a windows program running .Net (C#, if that matters).

I am currently reading remote registry keys (using this technique: https://stackoverflow.com/questions/1566547/how-to-read-remote-registry-keys), to find all of the Oracle Homes according to this method. This works fine, however, I have looked around those keys and do not see any information on the exact version/release.

The name of an Oracle Home itself is of course 1) not a reliable indicator and 2) does not have the exact version/release (for instance "10.2.0.4.0"). Basically I am looking for a way to figure out what the Oracle Universal Installer tells you in the Installed Products button.


I should clarify, all of the Servers will be running Windows 2003-2008.

  • Its gonna be difficult. Have a look at Oracle Universal installer, each component has his own version. You cannot determine the version on an entire Oracle Client installation - at least not for all the numbers. – Wernfried Domscheit Feb 26 '16 at 22:45
  • i think tnaping and Sqlplus provide actual version of the installation. In Windows you can use command prompt to spool the output of tnsping. C:\tnsping>>E:\tnspingoutput.txt. Then use high level language to extract version from the text file – JSapkota Feb 27 '16 at 1:05
  • @WernfriedDomscheit First, I am not asking about Client version, but the server versions. Secondly, you can determine it, it is the last level one child under a Home (the individual components are lower level children). I do it manually with Universal Installer all the time. I just don't want to spend the time to do it manually all the time. – RBarryYoung Feb 29 '16 at 0:29
  • What happens when the server is installed on Linux/Unix (which is I think the majority)? Then a C# program or reading the registry does not help. – Wernfried Domscheit Feb 29 '16 at 7:16
  • @WernfriedDomscheit In my case they are all Windows servers. I will clarify that in my question. – RBarryYoung Feb 29 '16 at 14:45
5

If the database homes were installed properly, the central inventory has a list about them. The central inventory on Windows is located at C:\Program Files\Oracle\Inventory. On Linux/UNIX platforms, the location of the central inventory can be found in /etc/oraInst.loc. In the inventory, in ContentsXML\inventory.xml, there is a list of installed homes in XML format, e.g:

<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.1.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/opt/oracle/grid12102" TYPE="O" IDX="1"/>
<HOME NAME="OraDB12Home1" LOC="/opt/oracle/base/product/db12102ee" TYPE="O" IDX="2"/>
<HOME NAME="OraDb11g_home1" LOC="/opt/oracle/base/product/db11204ee" TYPE="O" IDX="3"/>
</HOME_LIST>
</INVENTORY>

You can parse this list, and find detailed information with opatch for example:

/opt/oracle/grid12102/OPatch/opatch lsinventory -oh /opt/oracle/grid12102 -details
/opt/oracle/base/product/db12102ee/OPatch/opatch lsinventory -oh /opt/oracle/base/product/db12102ee -details
/opt/oracle/base/product/db11204ee/OPatch/opatch lsinventory -oh /opt/oracle/base/product/db11204ee -details

A Windows example would be:

C:\oracle\base\product\12.1.0\dbhome_1\OPatch\opatch lsinventory -oh C:\oracle\base\product\12.1.0\dbhome_1 -details

The above needs to be run on the server of course.

This is the best-case scenario, with proper installations. Worst-case scenario is, homes use separate inventories, or use no inventory at all, and you have to search all filesystems on the server for possible Oracle installations.

| improve this answer | |
4

Another method to display the Oracle version is calling the dbv utility. This works only for database server installations. The version of this tool should always match to the version of the database. You should set the appropriate environment first (PATH; ORACLE_HOME, LD_LIBRARY_PATH), then you will get something like

$ $ORACLE_HOME/bin/dbv

DBVERIFY: Release 12.1.0.2.0 - Production on Sun Jan 01 12:00:00 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Keyword     Description                    (Default)
----------------------------------------------------
FILE        File to Verify                 (NONE)
START       Start Block                    (First Block of File)
END         End Block                      (Last Block of File)
BLOCKSIZE   Logical Block Size             (8192)
LOGFILE     Output Log                     (NONE)
FEEDBACK    Display Progress               (0)
PARFILE     Parameter File                 (NONE)
USERID      Username/Password              (NONE)
SEGMENT_ID  Segment ID (tsn.relfile.block) (NONE)
HIGH_SCN    Highest Block SCN To Verify    (NONE)
            (scn_wrap.scn_base OR scn)

The first line contains the release

| improve this answer | |
  • This looks workable locally, is there any builtin way to invoke it remotely? – RBarryYoung Feb 29 '16 at 0:53
  • No, I don't thinks so. On an Linux system I would use ssh to try to login to the server. – miracle173 Feb 29 '16 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.