Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detemining a database's OS with a SQL query?

I'm writing a tool to gather customer configuration information. One of the questions I want to answer, what OS is the customer database running on.

I haven't found a generic way to find the OS with SQL and I can't create stored procedures on the customer's database.

If there is a way, it's probably vendor specific.

Suggestions? Thanks in advance.

like image 322
KaizenSoze Avatar asked Apr 21 '10 12:04

KaizenSoze


2 Answers

Yes, it will be vendor specific. For Oracle you can obtain it via this query:

SQL> select banner from v$version; 

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE    9.2.0.8.0       Production
TNS for Solaris: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production

The 4th row of output shows that my 9i database is running on Solaris (well, it shows that it is running "TNS for Solaris", which implies that the OS is Solaris anyway).

like image 163
Tony Andrews Avatar answered Sep 21 '22 11:09

Tony Andrews


For Oracle, you could use

SELECT DBMS_UTILITY.PORT_STRING FROM dual;

(From Ask Tom)

like image 38
PaulJ Avatar answered Sep 21 '22 11:09

PaulJ