Skip to Main Content
  • Questions
  • How to check Oracle server operating system from SQL or PL/SQL?


Question and Answer

Connor McDonald

Thanks for the question, Daryl.

Asked: January 08, 2002 - 10:46 am UTC

Last updated: February 16, 2024 - 6:11 am UTC

Version: 8.1.7

Viewed 50K+ times! This question is

You Asked

During the installation of some application software, we build the necessary schema objects in Oracle if they don't exist. Additionally, we point out any potential problems to the user doing the install. Some of these problems vary with the Oracle server platform. For example, the INSO filters for interMedia were not available for Oracle on Linux prior to 8.1.7. (So we need to suggest a workaround or a limitation for those people installing on Linux Oracle 8.1.6.)

I've not been able to see how to do this from SQL or PL/SQL. Can you suggest anything? (I've already written a Java stored procedure that returns System.getProperty("") along with the PL/SQL wrapper for it. However, I'd prefer a "pure" PL/SQL or SQL option, since this stuff is only run during the installation.)

and Tom said...

Here is a small cut and paste from my book that describes how to do this:


The DB_VERSION routine was added in Oracle 8.0 in order to make it easier for applications to figure out what version of the database they were running in. We could have used this in our CRYPT_PKG (see the DBMS_OBFUSCATION_TOOLKIT section) for example to tell users that attempted to use the DES3 routines in an Oracle 8.1.5 database that it would not work (instead of just trying to execute the DES3 routines and failing). It is a very simple interface as follows:

scott@TKYTE816> declare
2 l_version varchar2(255);
3 l_compatibility varchar2(255);
4 begin
5 dbms_utility.db_version( l_version, l_compatibility );
6 dbms_output.put_line( l_version );
7 dbms_output.put_line( l_compatibility );
8 end;
9 /

PL/SQL procedure successfully completed.

And provides more version detail then the older function PORT_STRING:

scott@TKYTE816> select dbms_utility.port_string from dual;


Using the port string, not only would you have to parse the string, but you cannot tell if you are in version 8.1.5 versus 8.1.6 versus 8.1.7. DB_VERSION will be more useful for that. On the other hand, the PORT_STRING does tell you what operating system you are on.


  (22 ratings)

Is this answer out of date? If it is, please let us know via a Comment


Another Option?

Mark A. Williams, January 08, 2002 - 3:49 pm UTC


I typically use this to get the version(s):


Are there any pro's/con's to using this method vs. the package call?

Also, is it possible to get a patchset release level? For example, I have installed patchset but the version will be reported as I understand that that is the version number of the server, but would like to find the patchset release level...

- Mark

Close, but where are the mappings?

Daryl, January 08, 2002 - 3:55 pm UTC

This is CLOSE to what I need. When my server is running on Windows, I get:

SQL> select dbms_utility.port_string from dual;


Under Solaris, I get:

SQL> select dbms_utility.port_string from dual;

SVR4-be-8.1.0 do I know that's SOLARIS, and not some other System V R4-based UNIX? Is there a list of mappings of port string codes to OS names? Searching Metalink provided no clues. (I already own your book, btw, so I appreciate the pointer to it. I just missed that one.) 

Tom Kyte
January 08, 2002 - 4:10 pm UTC

There is not as far as I know but it looks like this page is starting to collect them -- if everyone who has an OS that isn't represented yet posts em, we'll get them....

Interesting Results

Mark A. Williams, January 08, 2002 - 4:06 pm UTC


This is what I get on a couple of my boxes:

(select dbms_utility.port_string from dual;)

IBM AIX/RS600 V4 - 8.1.0


I don't have any other *nix platforms to test on... I wonder if hp/ux would show up as 'be' as well?

Does 'be' denote Solaris?


Brandon Lyon, January 08, 2002 - 4:29 pm UTC

Here is the HP-UX (64 bit) response (since someone asked):


hp ux answer

dan malumphy, January 08, 2002 - 4:30 pm UTC

SQL> select dbms_utility.port_string from dual
  2  /
this is 
uname -a
HP-UX hpn1 B.11.00 U 9000/800 621309343 unlimited-user license



Benny, January 08, 2002 - 4:31 pm UTC


quick question..

neeti, January 08, 2002 - 5:40 pm UTC

Is there a function in oracle to return the sid for
the same session inside a plsql procedure ?

Tom Kyte
January 08, 2002 - 6:59 pm UTC

The sid:

select sid from v$mystat where rownum = 1;

If you mean the Oracle_sid

select instance_name from v$instance;


Daryl, January 08, 2002 - 8:30 pm UTC

Oracle on Linux (Intel) reports:


my systems

Amit, January 09, 2002 - 1:58 am UTC

my systems show this:




For Tru64 UNIX version 5.1 on Compaq Alpha GS80

Johan Snyman, January 09, 2002 - 4:37 pm UTC

DEC Alpha OSF/1, r1.1-8.1.0

The Oracle version is

I guess not many people saw this one coming...

Frank, January 08, 2003 - 4:47 pm UTC

SQL> select dbms_utility.port_string from dual;


Who'd have thought.... :-) 

Kid, July 10, 2003 - 10:11 am UTC

then, what about this ???

select dbms_utility.port_string from dual;

DOS 5.0

32-bit vs 64-bit

A reader, September 18, 2007 - 5:39 pm UTC

Is there anyway to find out whether the operating system is 32 bits or 64 bits?

Luis Santos, September 19, 2007 - 1:19 pm UTC

Here we use the following query:

select rtrim(substr(replace(banner,'TNS for ',''),1,instr(replace(banner,'TNS for ',''),':')-1)) os
from   v$version
where  banner like 'TNS for %';

I use this query to fill a central table with information about all our databases. Look the result:

SQL> select os, count(*) from dbmon.hosts
  2  group by os;

OS                               COUNT(*)
------------------------------ ----------
32-bit Windows                          2
DEC OSF/1 AXP                           5
HPUX                                   69
Linux                                   8
Solaris                                 6

I think that the result of this query can be used joined with the result of PORT_STRING function to get a more detailed output. Note that I got "Solaris" in a Sun Solaris:

SQL> r
  1  select rtrim(substr(replace(banner,'TNS for ',''),1,instr(replace(banner,'TNS for ',''),':')-1)) os
  2  from   v$version
  3* where  banner like 'TNS for %'


SQL> select dbms_utility.port_string from dual;


SQL> host uname -a
SunOS tafraud 5.9 Generic_118558-39 sun4u sparc SUNW,Sun-Fire

Need same info in mount mode

Mette Juel, October 02, 2010 - 2:24 am UTC

Hi Tom

I have a script that need to be able run on version 8 thoruh 11 and on standby and normal db's.
The script need to determine the OS its running on , and if its a standby or not(its part af a general check script
collection data from many sources)

I have tried the platform_name from v$database (does not work on 8 and 9) and dbms_utility.port_string
(does nok work on standby, since they are in mount mode).

Where can I find the desired info?
The script is running as sysdba.


How about using ... ?

Vikas Sangar., March 21, 2013 - 11:11 am UTC

If right... I would use... V$version view..

select * from V$version; --Detailed info.

Oracle Database 11g Enterprise Edition Release - 64bit Production

PL/SQL Release - Production

CORE Production

TNS for Solaris: Version - Production

NLSRTL Version - Production

5 rows selected.

select * from v$version where BANNER like '%TNS%'; --Specific.

TNS for Solaris: Version - Production

1 row selected.

Hope this is useful.

Where's OpenVMS ?

Syltrem, November 06, 2013 - 4:44 pm UTC

Here's another one as I noticed VMS is missing...

But it's strange that it shows ALPHA when in fact I run this instance on Itanium, and the OS version is 8.3 not 8.1
Oracle version is

An Alpha server running OpenVMS 8.4 and Oracle shows the same.

SQL> select dbms_utility.port_string from dual;


1 ligne sélectionnée.


Regarding OS Version.

Nitesh, April 11, 2014 - 5:34 am UTC

Hi all ,

This post helped me but result is wrong after executing below sql.

select dbms_utility.port_string from dual;

IBM AIX64/RS6000 V4 - 8.1.0

My OS Version is 7.1.0 but it displayed 8.1.0.

I checked in another environment which is LINUX just for confirmation and found irrelevant result.

x86_64/Linux 2.4.xx

Can i have some clarification on it.

Thanks & Regards,
Nitesh pareek.

Finding the difference between HPUX versions

Trey, September 04, 2018 - 4:43 pm UTC

How do you find what version of HPUX you have on your box? Specifically, when I run uname -a or select dbms_utility.port_string from dual; neither tells me if it is Itanium or PA-RISC
Thank you for your help!

Found this:

A reader, September 04, 2018 - 7:00 pm UTC

This worked for finding which machine is Itanium and which is PA-RISC:
Connor McDonald
September 05, 2018 - 4:48 am UTC

Thanks for the info.

If you need that from SQL, just plonk an external table plus preprocessor on it and you can get it from inside the database.

Search this site for "preprocessor" for examples

from v$database

Rajeshwaran, Jeyabal, September 07, 2018 - 8:05 am UTC


these days can't we get these platform details from v$database itself?

still we need to look around apart from v$database for these details?

SQL> connect app_user/********@pods6
SQL> select platform_id,platform_name from v$database;

----------- ------------------------------
          4 HP-UX IA (64-bit)

SQL> Conn app_user/********@pods4
SQL> select platform_id,platform_name from v$database;

----------- ------------------------------
         13 Linux 64-bit for AMD

SQL> Conn app_user/********@pods3
SQL> select platform_id,platform_name from v$database;

----------- ------------------------------
         12 Microsoft Windows x86 64-bit


Connor McDonald
September 08, 2018 - 10:37 am UTC

Windows 7 ? Windows 8 ? Windows 10 ? etc...

You get *some* info from the database. Sometimes you want more detail.

MAC OS SQL Developer connections in DB

A reader, February 08, 2024 - 7:30 pm UTC


Is there any way to find the SQL Developer connections in database coming from MAC OS (Apple lattop) Ors its ffrom Windows.

Connor McDonald
February 16, 2024 - 6:11 am UTC

I would suspect you might have to go looking at V$SESSION.MACHINE/TERMINAL and map that back to machine <=> platform mapping in your organization

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library