What's the best way to determine which version of Oracle client I'm running?

前端 未结 14 1913
遥遥无期
遥遥无期 2020-12-12 23:46

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 su

相关标签:
14条回答
  • 2020-12-13 00:01

    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.

    0 讨论(0)
  • 2020-12-13 00:03

    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.

    0 讨论(0)
  • 2020-12-13 00:06

    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
    
    0 讨论(0)
  • 2020-12-13 00:10

    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:

    0 讨论(0)
  • 2020-12-13 00:13

    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.

    0 讨论(0)
  • 2020-12-13 00:15

    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
    
    0 讨论(0)
提交回复
热议问题