84

The subject says it all: What is the best way to determine the exact version of the oracle client I'm running? Our clients are all running Windows.

I found one suggestion to run the tnsping utility, without parameters, which does display the version information. Is there a better way?

Does the client install put this information in any sort of text file?

3
  • 1
    What would qualify as "a better way"?
    – skaffman
    Jul 23, 2009 at 13:20
  • 1
    You could also create a batch file, consisting of just tnsping > version.txt, and distribute it to all your client PCs. Jul 23, 2009 at 13:27
  • 2
    @skaffman - a "better way" would be something official from oracle
    – chris
    Jul 23, 2009 at 13:56

14 Answers 14

46
+100

You can use the v$session_connect_info view against the current session ID (SID from the USERENV namespace in SYS_CONTEXT).

e.g.

SELECT
  DISTINCT
  s.client_version
FROM
  v$session_connect_info s
WHERE
  s.sid = SYS_CONTEXT('USERENV', 'SID');
4
  • Me, Being new to oracle, How can I find the 'userenv' from the SQLDeveloper? Oct 27, 2014 at 11:09
  • 2
    'userenv' is a specific namespace for the sys_context function and is a constant.
    – Josh Bode
    Oct 27, 2014 at 11:19
  • Is there a way to tell if 32 bit or 64 bit is installed from the query above?
    – Exodus
    Jun 10, 2020 at 21:53
  • @DonaldLi - possibly from the network_service_banner field, but I'm not sure if that's reliable
    – Josh Bode
    Jun 11, 2020 at 22:51
34

TNSPing command line will show the version. similarly, sqlPlus.exe will print its version. You can also go to the readme files in the 'relnotes' directory of your client install. Version 10.2 has a file named README_jdbc.txt, for example, which will tell you which version has been installed.

3
  • When I run sqlPlus.exe it gives me the client version 11.0.1.0 and when I connect to the DB I get the server version of 11.0.3.0 (64 Bit). Can I assume that my client is 32 bit because it doesn't state 64?
    – TomG
    Jan 22, 2014 at 9:33
  • @TomG: No, you cannot. See stackoverflow.com/questions/13188670/…
    – mmey
    Mar 6, 2014 at 10:15
  • 1
    sqlplus -V SQL*Plus: Release 12.2.0.1.0 Production
    – Straff
    Nov 28, 2018 at 7:40
23

Issue #1: Multiple Oracle clients are installed.

A very common issue I see in my environment is that I see both workstations and (app) servers with multiple Oracle clients, sometimes as many as four, and possibly with different versions and architectures. If you are relying on the PATH and running a utility like SQLPLUS or TNSPING you'll have one of two unacceptable results:

  • either your PATH successfully resolves the executable and you get ONE version result
  • or, the PATH didn't resolve the executable, and you get no results.

Either way, you are blind to possibly multiple client installations.

Issue #2: Instant Client doesn't have TNSPING, and sometimes doesn't include SQL*Plus.

If a computer has the Oracle Instant Client (not the full client), then TNSPING is not included, and SQLPLUS is an optional-addon. So can't rely on those tools being there. Furthermore, the Instant Client is sometimes installed as an unzip-and-go solution, so there's no Oracle Inventory and nothing in HKLM.

Issue #3: Client was installed using "Custom", and ODBC, OLEDB, ODP.Net, and JDBC were not installed.

Obvious case, there will be no ODBC or JDBC readme's to scrape version info from.

Solution:

One thing that the Instant client and the full client have in common is a DLL file called oraclient10.dll, oraclient11.dll, generally: oraclient*.dll. So let's traverse the hard disk to find them and extract their version info. PowerShell is amazing at this and can do it in one line, reminds me of home sweet Unix. So you could do this programatically or even remotely.

Here's the one-liner (sorry about the right scroll, but that's the nature of one-liners, eh?). Supposing you're already in a PowerShell:

gci C:\,D:\ -recurse -filter 'oraclient*.dll' -ErrorAction SilentlyContinue | %{ $_.VersionInfo } | ft -Property FileVersion, FileName -AutoSize

And if you're not in PowerShell, i.e. you're simply in a CMD shell, then no problem, just call powershell " ... ", as follows:

powershell "gci C:\,D:\ -recurse -filter 'oraclient*.dll' -ErrorAction SilentlyContinue | %{ $_.VersionInfo } | ft -Property FileVersion, FileName -AutoSize"

Example Outputs

Here's some outputs from some of my systems. This bad citizen has 3 Oracle 11.2.0.3 clients. You can see that some of them are 32-bit and others are 64-bit:

FileVersion            FileName
-----------            --------
11.2.0.3.0 Production  C:\NoSync\app\oracle\product\11.2\client_1\bin\oraclient...
11.2.0.3.0 Production  C:\oracle\product\11.2.0\client_1\bin\oraclient11.dll
11.2.0.3.0 Production  C:\oracle64\product\11.2.0\client_1\bin\oraclient11.dll

Another system, this one has 10g client on the D:\

FileVersion           FileName
-----------           --------
10.2.0.4.0 Production D:\oracle\product\10.2\BIN\oraclient10.dll

Caveats/Issues

  • This obviously requires PowerShell, which is standard in Windows 7+ and Server 2008 R2+. If you have XP (which you shouldn't any more) you can easily install PowerShell.

  • I haven't tried this on 8i/9i or 12c. If you are running 8i/9i, then there's a good chance you are on an old OS as well and don't have PowerShell and Heaven help you. It should work with 12c, since I see there is such a file oraclient12.dll that gets installed. I just don't have a Windows 12c client to play with yet.

3
  • 2
    Can also check properties of oci.dll on Windows.
    – Ivan Chau
    Oct 7, 2016 at 2:47
  • 1
    "You can see that some of them are 32-bit and others are 64-bit" - Only because they've been installed under a helpfully-named folder structure, though... the default would be client_1 and client_2...
    – m-smith
    May 4, 2018 at 14:09
  • 1
    @oliver-clare, fair callout. A few extra PowerShell commands should be able to print out the architecture of those DLLs. Exercise is left to the reader. May 4, 2018 at 16:55
10

In Unix

If you don’t know the location or version of installed Oracle product, you can find it from the inventory which is usually recorded in /etc/oraInst.loc

> cat /etc/oraInst.loc

inventory_loc=/export/oracle/oraInventory       **--> Inventory location**
inst_group=dba


> cd /export/oracle/oraInventory
> cd ContentsXML

Here look for a file inventory.xml

> cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2010, Oracle. All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>11.2.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDB_11G" LOC="/export/oracle/product/11.2.0.2" TYPE="O" IDX="2">

Once you know the install location

export ORACLE_HOME=full path to install location
export ORACLE_HOME=/export/oracle/product/11.2.0.2
export PATH=$ORACLE_HOME/bin:$PATH

A simple "sqlplus" will give you the version of the client installed.

> sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 23 14:51:09 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter user-name:

In the above example, the version of Oracle client is 11.2.0.1

In Windows

Registry location variable in windows is INST_LOC

Start > Run > regedit > HKLM > Software > Oracle

Check the Inst_loc entry value which will be the software installed location.

You can use command prompt or you can navigate/explore to the oracle home location and then cd to bin directory to lauch sqlplus which will give you the client version information.

7

you can use the following command in SQL Developer or SQLPLUS in command prompt to find out the Oracle server version number.

select * from v$version;

in my case it gave me the below mentioned info.

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE   11.2.0.1.0  Production"
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
1
  • This is the version of the server, not the client
    – Josh Bode
    Mar 30, 2023 at 3:26
6

Run the installer, click "Installed Products...". This will give you a more detailed list of all installed components of the client install, e.g., drivers, SQL*Plus, etc.

Typical Oracle installations will store inventory information in C:\Program Files\Oracle\Inventory, but figuring out the installed versions isn't simply a matter of opening a text file.

This is AFAIK authoritative, and shows any patches that might have been applied as well (which running the utilities does not do).

EDIT: A CLI option would be to use the OPatch utility:

c:\> path=%path%;<path to OPatch directory in client home, e.g., C:\oracle\product\10.2.0\client_1\OPatch>
c:\>set ORACLE_HOME=<oracle home directory of client, e.g., C:\Oracle\product\10.2.0\client_1>
c:\>opatch lsinventory

This gives you the overall version of the client installed.

1
  • 2
    ...and you'll usually have one installer instance for each oracle home (check your path variable), so you may need to start up more than one installer to see all installed client products.
    – mike
    Jun 30, 2015 at 14:12
5

In Windows -> use Command Promt:

tnsping localhost

It show the version and if is installed 32 o 64 bit client, for example:

TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 03-MAR-2015 16:47:26

Source: https://decipherinfosys.wordpress.com/2007/02/10/checking-for-oracle-client-version-on-windows/

5

Go to "Control Panel" -> "Administrative Tools" and open "Datasources (ODBC)". By default, the tab "User-DSN" will be opened, click "Add" and a dialogue will pop up:

enter image description here

1
  • That only works on windows if using ODBC to connect to Oracle Aug 4, 2016 at 9:44
2

You should put a semicolon at the end of select * from v$version;.

Like this you will get all info you need...

If you are looking just for Oracle for example you can do as:

SQL> select * from v$version where banner like 'Oracle%';
2
  • 5
    I think this might get the version of the server, not the client. May 17, 2012 at 17:11
  • I get ORA-01039: insufficient privileges on underlying objects of the view. but I believe if I had the permissions, that you are correct. Actually the question was for client not server. Sorry Sep 14, 2012 at 17:52
2

This is another, though not necessarily "better", way:

Determining Your Current Version

To determine which Oracle client version you have installed on your pc, run sql*plus to connect to the DW. The folder names may vary somewhat based on your Oracle setup but should be similar. To run sql*plus choose start > programs > Oracle > Oracle - OUDWclient > Application Development > sqlplus. Enter your DW user name, password, and 'ordj' for the host name or service name. This should connect you to the DW via sqlplus. At this point, you could write your own sql statements to pull information from the DW (if you knew sql). The Oracle client version can be determined in the first line - 'SQL*Plus: Release 10.2.0.1.0'.

[Reference] Oracle Client Information http://www.ohio.edu/technology

1

I am assuming you want to do something programatically.

You might consider, using getenv to pull the value out of the ORACLE_HOME environmental variable. Assuming you are talking C or C++ or Pro*C.

2
  • In windows, ORACLE_HOME is typically not set - it's in the registry. Even if it were, the typical ORACLE_HOME setting would be a path you'd have to parse the version number out of (assuming a default install - you could install it anywhere) and that version (at least in 10g) is only specified as '10.2.0'.
    – DCookie
    Jul 23, 2009 at 17:43
  • yep, that is how we extract it.
    – EvilTeach
    Jul 24, 2009 at 3:53
0

You can get the version of the oracle client by running this command sqlplus /nolog on cmd. Another alternative will be to browse to the path C:\Program Files\Oracle\Inventory and open the "Inventory.xml" file which will give you the version as per below:

<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2019, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.2.0.1.4</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
-1

Go to ORACLE_HOME/bin and run 'file sqlplus'. see output below.

64-Bit:- cd /tech/oracle/product/v11/bin

$  file sqlplus

sqlplus: **ELF 64-bit** LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped


32-Bit $ cd /tech/oracle/product/11204_32bit/bin

$ file sqlplus

sqlplus: **ELF 32-bit** LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
1
  • 1
    That tells nothing about the actual Oracle version of the sqlplus client. Aug 4, 2016 at 9:45
-4

Just run this: select * from v$version

1
  • 7
    That will tell me the version of the server, not the client.
    – chris
    Oct 31, 2011 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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