如何查找Linux服务器上安装的Oracle版本(在终端中)

时间:2022-11-08 06:59:11

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文件,但我似乎无法找到该版本。

7 个解决方案

#1


8  

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}'

#2


11  

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%';

#3


3  

Login as sys user in sql*plus. Then do this query:

以sql * plus身份以sys用户身份登录。然后执行此查询:

select * from v$version; 

or

要么

select * from product_component_version;

#4


2  

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.

正如A.B.Cada指出的那样,您可以使用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文件以查看每个实例使用的实例和db home。可以为每个服务器安装多个版本的oracle以及多个实例。 / etc / oratab文件将列出所有实例和db home。从oracle db home开始,您可以运行“opatch lsinventory”来查找安装了db的exaction版本以及应用于该db安装的任何补丁。

#5


1  

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.

当然,这取决于版本号实际上对应于实际的服务器版本,它应该用于正确安装的实例。

#6


1  

you can also check by

你也可以查看

ps -ef |grep -i ora

#7


0  

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主页或Linux服务器上安装Oracle安装文件的位置。

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

#1


8  

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}'

#2


11  

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%';

#3


3  

Login as sys user in sql*plus. Then do this query:

以sql * plus身份以sys用户身份登录。然后执行此查询:

select * from v$version; 

or

要么

select * from product_component_version;

#4


2  

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.

正如A.B.Cada指出的那样,您可以使用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文件以查看每个实例使用的实例和db home。可以为每个服务器安装多个版本的oracle以及多个实例。 / etc / oratab文件将列出所有实例和db home。从oracle db home开始,您可以运行“opatch lsinventory”来查找安装了db的exaction版本以及应用于该db安装的任何补丁。

#5


1  

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.

当然,这取决于版本号实际上对应于实际的服务器版本,它应该用于正确安装的实例。

#6


1  

you can also check by

你也可以查看

ps -ef |grep -i ora

#7


0  

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主页或Linux服务器上安装Oracle安装文件的位置。

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