Detemining a database's OS with a SQL query?
I'm writing a tool to gather custome开发者_C百科r 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.
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).
For Oracle, you could use
SELECT DBMS_UTILITY.PORT_STRING FROM dual;
(From Ask Tom)
how about: select platform_name from v$database;
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
精彩评论