Discussion Locked

What OS is Oracle is installed on?

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How many and what ways are there to identify the operating system in which oracle is running using PL/SQL?

11 replies

by rodsherer

Potential answers. Looking for more though...

Of the preffered solutions:
>>Using straight PL/SQL - you can try the table GV_$VERSION .
The only clue of the five lines in this installation is one banner that has "TNS for Solaris" in it. It doesn't tell us which version of Solaris we're running. The other lines don't mention the OS at all.

>>But, from sql*plus you can host out and check environment variables.
Which will tell you the OS that the SQL*Plus client is on *not* the database.

>>Or if you have the http server installed in the database server you can request the web server op system type.
Who installs their web server in the database?

As far as I can see there is no way of finding this info out. You might be able to use a Java Stored Procedure that runs OS execeutables to test whether you're on a *nix box or a Windows box, but I don't think there's any way of telling which version/flavour you're on.

by why

If all you want to know is ix / win the how about:

select substr(name,1,1) from v$datafile where ts# = 0

if it's an alpha, then it sure ain't unix ...

(if you want to be purer join with v$tablespace and use tablespacename = 'SYSTEM' !)

Otherwise, tricky - it must be in there somewhere!

by rodsherer

To use these methods, you must be logged in as a system administrator, and thus can not be incorporated into the PL/SQL packages loaded to the schema.

by why

True, I assumed that this was something that would be an install / configure issue rather than a general runtime one. Interesting though - what's your particular problem?

by rodsherer

What is being attempted is a workaround. In a standard Windows installation of the software, we use a *.dll to do some of the work for use such as registry checking, license validation, etc. Other than that *.dll, everything will work with UNIX on the server side. However, when we make the RPC calls, we have to know why they failed. If it is UNIX, then we know we have sold a complete license and they are allowed to access any module they want. If it is Windows, we check the license before allowing them access to certain modules. This is a call from the PL/SQL packages during on line transactions as well as batch job processing. We are currently using the method of checking v$version, but see that as a hack until we can find something more solid to work with. That was the best way according to Oracle Technet, but if someone has come up with something better we would like to at least take a look to see if it will work for our application.

by why

Of course, once you solve this one "properly" your organisations licensing policy will change, making this dialogue irrelevent.

Anything that has to do transaction level license checks needs to be lightweight - I'd look at implementing my own setof "capability" tables encapsulated in "can_I" functions. They'd end up being cached, so minimal peformance hit.

Alternatively, there's license managers like flexlm, which works (from a user perspective anyway) in a heterogenoeus environment.

However, the original question will fester in my mind until I have an answer ...

Regards

Dave

by rodsherer

If I come up with a solid way to find the OS from within Oracle I will post it under this question. So far all the ideas I have come up with or received are here already. currently we are using this query.
SELECT 1
FROM v$version
WHERE UPPER(banner) LIKE 'TNS FOR%' AND
UPPER(banner) NOT LIKE '%WINDOWS%';

by why

As is always the way, I found this while desperately looking for something else ...

select dbms_utility.port_string from dual;

Result is less than precise, but enough for *ix / Win

Doesn't seem to need any special access rights.

Incidentally, I also found (and it's extraordinarily useful in those real panic moments) dbms_session.set_sql_trace_in_session

Regards,
Dave

Incidentally

by rodsherer

Great find. Seems to work consistently against Windows (NT/2000/XP) and the Oracle versions we support. I think this will be a useable solution to our issue. Thanks for the assist.

This discussion is closed to new replies.