Low Orbit Flux Logo 2 F

How To Check Oracle Version In Linux

Have you ever been handed a database server that someone else used to be responsible for? Are people asking you questions about this server now? Do you need to know how to check Oracle version in Linux? If you are a sysadmin and don’t know much about Oracle then this might not be obvious. You also might not have a DBA around to ask. You might BE the DBA. If you are the DBA you really should know this but who knows maybe you have only ever worked with MySQL or Sybase and someone just recently decided that you would now have to be an Oracle admin. Whatever the reason is, we have you covered.

Here is one way to check the version of Oracle from a Linux server. You are going to want to be logged in as the user that the database runs as.


$ORACLE_HOME/OPatch/opatch lsinventory | awk '/^Oracle Database/ {print $NF}'

You can also connect to the database and run the following SQL command:


select * from v$version where banner like 'oracle%';

Assuming your Oracle user is just ‘oracle’ you can login and check the path based on your ORAHOME variable. The path will probably contain the version number.


su - oracle
echo $ORAHOME

Also, just running SQL plus should give you the version. You can also use the version option.


su - oracle
sqlplus
sqlplus -version

How To Check Oracle Version In Linux - Things to Check

You could also grep for ORACLE_HOME in your init script. This is assuming that the init script is located at this path. This will depend on your system. It also depends on your installation path matching the actual version that is installed. They should both match.


grep ORACLE_HOME /etc/init.d/oracle-xe

Another place to look might be inside your /etc/oratab file. This is also good if you have multiple instances of Oracle running,


cat /etc/oratab

You could figure it out based on the output of the ps command. You will probably see the installation path right in the output. This should contain the version number.


ps -ef |grep -i oracle

You can also use the inspdver command.


$ORACLE_HOME/orainst/inspdver