windows 确定我正在运行的 Oracle 客户端版本的最佳方法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1171643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the best way to determine which version of Oracle client I'm running?
提问by chris
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.
该主题说明了一切:确定我正在运行的 Oracle 客户端的确切版本的最佳方法是什么?我们的客户都在运行 Windows。
I found one suggestion to run the tnsping utility, without parameters, which does display the version information. Is there a better way?
我找到了一个运行 tnsping 实用程序的建议,不带参数,它确实显示了版本信息。有没有更好的办法?
Does the client install put this information in any sort of text file?
客户端安装是否将此信息放在任何类型的文本文件中?
回答by Josh Bode
You can use the v$session_connect_info
view against the current session ID (SID
from the USERENV
namespace in SYS_CONTEXT
).
您可以v$session_connect_info
针对当前会话 ID(SID
来自 中的USERENV
命名空间SYS_CONTEXT
)使用该视图。
e.g.
例如
SELECT
DISTINCT
s.client_version
FROM
v$session_connect_info s
WHERE
s.sid = SYS_CONTEXT('USERENV', 'SID');
回答by akf
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.
TNSPing 命令行将显示版本。同样,sqlPlus.exe 将打印其版本。您还可以转到客户端安装的“relnotes”目录中的自述文件。例如,版本 10.2 有一个名为 README_jdbc.txt 的文件,它会告诉您安装了哪个版本。
回答by Joshua Huber
Issue #1: Multiple Oracle clients are installed.
问题 #1:安装了多个 Oracle 客户端。
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:
我在我的环境中看到的一个非常常见的问题是,我看到工作站和(应用程序)服务器都有多个 Oracle 客户端,有时多达四个,并且可能具有不同的版本和架构。如果您依赖PATH
并运行类似SQLPLUS
or的实用程序,TNSPING
您将获得以下两种不可接受的结果之一:
- 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.
- 要么你
PATH
成功解析了可执行文件,你就会得到一个版本结果 - 或者,
PATH
没有解析可执行文件,并且您没有得到任何结果。
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.
问题 2:Instant Client 没有 TNSPING,有时不包括 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.
如果计算机具有 Oracle Instant Client(不是完整客户端),TNSPING
则不包括在内,并且SQLPLUS
是可选插件。所以不能依赖那些工具在那里。此外,Instant Client 有时作为解压缩即用解决方案安装,因此没有 Oracle Inventory,HKLM 中也没有。
Issue #3: Client was installed using "Custom", and ODBC, OLEDB, ODP.Net, and JDBC were not installed.
问题 #3:使用“自定义”安装客户端,但未安装 ODBC、OLEDB、ODP.Net 和 JDBC。
Obvious case, there will be no ODBC or JDBC readme's to scrape version info from.
明显的情况下,将没有 ODBC 或 JDBC 自述文件可以从中获取版本信息。
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.
有一两件事,即时客户端和完整的客户端有一个共同点,就是被称为一个DLL文件oraclient10.dll
,oraclient11.dll
一般:oraclient*.dll
。因此,让我们遍历硬盘以找到它们并提取它们的版本信息。PowerShell 在这方面非常出色,并且可以在一行中完成,让我想起了甜蜜的 Unix。因此,您可以以编程方式甚至远程方式执行此操作。
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:
这是单行(对正确的卷轴感到抱歉,但这就是单行的性质,嗯?)。假设您已经在 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 中,即您只是在 CMD shell 中,那么没问题,只需调用powershell " ... "
,如下所示:
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:
这是我的一些系统的一些输出。这个坏公民有 3 个 Oracle 11.2.0.3 客户端。您可以看到其中一些是 32 位的,而另一些是 64 位的:
FileVersion FileName
----------- --------
11.2.0.3.0 Production C:\NoSync\app\oracle\product.2\client_1\bin\oraclient...
11.2.0.3.0 Production C:\oracle\product.2.0\client_1\bin\oraclient11.dll
11.2.0.3.0 Production C:\oracle64\product.2.0\client_1\bin\oraclient11.dll
Another system, this one has 10g client on the D:\
另一个系统,这个在 D:\ 上有 10g 客户端
FileVersion FileName
----------- --------
10.2.0.4.0 Production D:\oracle\product.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 shouldwork 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.
这显然需要 PowerShell,这是 Windows 7+ 和 Server 2008 R2+ 中的标准配置。如果你有 XP(你不应该再有),你可以轻松安装 PowerShell。
我还没有在 8i/9i 或 12c 上试过这个。如果您正在运行 8i/9i,那么您很有可能也在旧操作系统上,并且没有 PowerShell 和 Heaven 帮助您。它应该适用于 12c,因为我看到有这样一个文件
oraclient12.dll
被安装。我只是还没有 Windows 12c 客户端可以玩。
回答by Samuel Nelson Isaac
In Unix
在 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
如果您不知道已安装的 Oracle 产品的位置或版本,您可以从 /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
在这里寻找一个文件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”会给你安装的客户端版本。
> 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
上例中Oracle客户端版本为11.2.0.1
In Windows
在 Windows 中
Registry location variable in windows is INST_LOC
Windows 中的注册表位置变量是INST_LOC
Start > Run > regedit > HKLM > Software > Oracle
Check the Inst_loc entry value which will be the software installed location.
检查将作为软件安装位置的 Inst_loc 条目值。
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.
您可以使用命令提示符,或者您可以导航/探索到 oracle 主位置,然后 cd 到 bin 目录以启动 sqlplus,这将为您提供客户端版本信息。
回答by DCookie
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.
运行安装程序,单击“已安装的产品...”。这将为您提供客户端安装的所有已安装组件的更详细列表,例如驱动程序、SQL*Plus 等。
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.
典型的 Oracle 安装会将清单信息存储在 C:\Program Files\Oracle\Inventory 中,但确定已安装的版本不仅仅是打开文本文件的问题。
This is AFAIK authoritative, and shows any patches that might have been applied as well (which running the utilities does not do).
这是 AFAIK 权威,并显示可能已应用的任何补丁(运行实用程序不会这样做)。
EDIT: A CLI option would be to use the OPatch utility:
编辑:CLI 选项是使用 OPatch 实用程序:
c:\> path=%path%;<path to OPatch directory in client home, e.g., C:\oracle\product.2.0\client_1\OPatch>
c:\>set ORACLE_HOME=<oracle home directory of client, e.g., C:\Oracle\product.2.0\client_1>
c:\>opatch lsinventory
This gives you the overall version of the client installed.
这为您提供了安装的客户端的整体版本。
回答by Hernaldo Gonzalez
In Windows -> use Command Promt:
在 Windows -> 使用命令提示符:
tnsping localhost
本地主机
It show the version and if is installed 32 o 64 bit client, for example:
它显示版本以及是否安装了 32 o 64 位客户端,例如:
TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 03-MAR-2015 16:47:26
适用于 64 位 Windows 的 TNS Ping 实用程序:版本 10.2.0.4.0 - 2015 年 3 月 3 日 16:47:26 生产
Source: https://decipherinfosys.wordpress.com/2007/02/10/checking-for-oracle-client-version-on-windows/
来源:https: //decipherinfosys.wordpress.com/2007/02/10/checking-for-oracle-client-version-on-windows/
回答by Boern
回答by ICEMAN
you can use the following command in SQL Developer or SQLPLUS in command prompt to find out the Oracle serverversion number.
您可以在 SQL Developer 中使用以下命令或在命令提示符下使用 SQLPLUS 来查找 Oracle服务器版本号。
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
回答by Jakub
You should put a semicolon at the end of select * from v$version;
.
你应该在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:
例如,如果您只是在寻找 Oracle,则可以执行以下操作:
SQL> select * from v$version where banner like 'Oracle%';
回答by Daniel F. Thornton
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 choosestart > 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'.
确定您当前的版本
要确定您的 PC 上安装了哪个 Oracle 客户端版本,请运行 sql
*
plus 连接到 DW。文件夹名称可能会因您的 Oracle 设置而有所不同,但应该相似。要运行 sql*
plus 选择start > programs > Oracle > Oracle - OUDWclient > Application Development > sqlplus
. 输入您的 DW 用户名、密码和主机名或服务名的“ordj”。这应该通过 sqlplus 将您连接到 DW。这时候就可以自己写sql语句从DW中拉取信息了(如果你懂sql的话)。Oracle 客户端版本可以在第一行 - 'SQL*Plus: Release 10.2.0.1.0' 中确定。
[Reference]Oracle Client Information http://www.ohio.edu/technology
【参考】Oracle 客户端信息http://www.ohio.edu/technology