views:

93

answers:

4

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.

+3  A: 

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).

Tony Andrews
Thanks. I found the answer for sql server.select @@versionYou'll get something like this:Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3) Compare the Windows version number to this list.http://www.nirmaltv.com/2009/08/17/windows-os-version-numbers/
KaizenSoze
Thanks for the Oracle answers. Anyone have an idea for Sybase?
KaizenSoze
+2  A: 

For Oracle, you could use

SELECT DBMS_UTILITY.PORT_STRING FROM dual;

(From Ask Tom)

Paul James
+1  A: 

how about: select platform_name from v$database;

MichaelN
+1  A: 

sybase ASE & Sybase IQ are the same as sqlserver: select @@version eg

Sybase IQ/12.7.0/090824/P/ESD 7/Sun_Sparc/OS 5.9/64bit/2009-08-24 16:17:12

Adaptive Server Enterprise/12.5.3/EBF 12455 ESD#2/P/Sun_svr4/OS 5.8/ase1253/1904/64-bit/FBO/Wed Mar 23 03:04:04 2005
Terence