如何查找 Linux 服务器上安装的 Oracle 版本(在终端中)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10882967/
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
How to find which version of Oracle is installed on a Linux server (In terminal)
提问by PolarisUser
I am in terminal in Redhat 5.5 and I need to find out which version of Oracle is installed. I am pretty new at Linux, but I have searched Google for a while and I can't find what I need. I have to locate which version is installed via terminal. I found the Oracle files, but I can't seem to find the version.
我在 Redhat 5.5 的终端中,我需要找出安装了哪个版本的 Oracle。我对 Linux 还很陌生,但我已经在 Google 上搜索了一段时间,但找不到我需要的东西。我必须找到通过终端安装的版本。我找到了 Oracle 文件,但似乎找不到版本。
采纳答案by mleu
As the user running the Oracle Database one can also try $ORACLE_HOME/OPatch/opatch lsinventory
which shows the exact version and patches installed.
作为运行 Oracle 数据库的用户,还可以尝试$ORACLE_HOME/OPatch/opatch lsinventory
显示确切版本和安装的补丁。
For example this is a quick oneliner which should only return the version number:
例如,这是一个快速的oneliner,它应该只返回版本号:
$ORACLE_HOME/OPatch/opatch lsinventory | awk '/^Oracle Database/ {print $NF}'
回答by Rahul
Enter in sqlplus (you'll see the version number)
输入sqlplus(你会看到版本号)
# su - oracle
oracle# sqlplus
OR
或者
echo $ORAHOME
Will give you the path where Oracle installed and path will include version number.
将为您提供 Oracle 安装路径,路径将包含版本号。
OR
或者
Connect to Oracle DB and run
连接到 Oracle DB 并运行
select * from v$version where banner like 'oracle%';
回答by MichaelN
As A.B.Cada pointed out, you can query the database itself with sqlplus for the db version. That is the easiest way to findout what is the version of the db that is actively running. If there is more than one you will have to set the oracle_sid appropriately and run the query against each instance.
正如 ABCada 所指出的,您可以使用 sqlplus 查询数据库本身的 db 版本。这是找出正在运行的数据库版本的最简单方法。如果有多个,则必须适当地设置 oracle_sid 并对每个实例运行查询。
You can view /etc/oratab file to see what instance and what db home is used per instance. Its possible to have multiple version of oracle installed per server as well as multiple instances. The /etc/oratab file will list all instances and db home. From with the oracle db home you can run "opatch lsinventory" to find out what exaction version of the db is installed as well as any patches applied to that db installation.
您可以查看 /etc/oratab 文件以查看每个实例使用的实例和数据库主目录。可以为每个服务器安装多个版本的 oracle 以及多个实例。/etc/oratab 文件将列出所有实例和 db home。从 oracle db home 中,您可以运行“opatch lsinventory”以找出安装的 db 的确切版本以及应用于该 db 安装的任何补丁。
回答by Magnilex
I solved this in about 1 minute by just reading the startup script (in my case /etc/init.d/oracle-xe):
我通过阅读启动脚本(在我的例子中是/etc/init.d/oracle-xe)在大约 1 分钟内解决了这个问题:
less /etc/init.d/oracle-xe
少 /etc/init.d/oracle-xe
At almost the beginning of the file I found:
在几乎文件的开头我发现:
ORACLE_HOME=[PATH_TO_INSTALLATION_INCLUDING_VERSION_NUMBER]
ORACLE_HOME= [PATH_TO_INSTALLATION_INCLUDING_VERSION_NUMBER]
This was the quickest solution for me because I knew where the script was located, and that it is used for starting/restarting the server.
这对我来说是最快的解决方案,因为我知道脚本所在的位置,并且它用于启动/重新启动服务器。
Of course, this relies on that the version number actually corresponds to the actual server version, which it should for a correctly installed instance.
当然,这依赖于版本号实际上对应于实际的服务器版本,对于正确安装的实例应该是这样。
回答by Vinil
you can also check by
你也可以通过
ps -ef |grep -i ora
回答by Linuxkenya
Login as sys user in sql*plus. Then do this query:
在 sql*plus 中以 sys 用户身份登录。然后做这个查询:
select * from v$version;
or
或者
select * from product_component_version;
回答by dimas
A bit manual searching but its an alternative way...
Find the Oracle home or where the installation files for Oracle is installed on your linux server.
有点手动搜索,但它是另一种方式...
找到 Oracle 主目录或 Oracle 安装文件在您的 linux 服务器上的安装位置。
cd / <-- Goto root directory
find . -print| grep -i dbm*.sql
Result varies on how you installed Oracle but mine displays this
结果因您安装 Oracle 的方式而异,但我的显示此内容
/db/oracle
Goto the folder
进入文件夹
less /db/oracle/db1/sqlplus/doc/README.htm
scroll down and you should see something like this
向下滚动,您应该会看到类似这样的内容
SQL*Plus Release Notes - Release 11.2.0.2
SQL*Plus 发行说明 -发行版 11.2.0.2