Systems Engineering and RDBMS

Documenting the OS of the DB Server in Oracle

Posted by decipherinfosys on September 26, 2007

Since Oracle runs on multiple operating systems, if you want to develop an auditing script in which you document the OS of the DB Server using PL/SQL scripts (since the rest of the auditing scripts will also be a combination of PL/SQL scripts, shell scripts and WMI scripts (windows)), one can make use of the inbuilt packages.  There are various ways of finding operating system of the database server. One of the easier ways is to use DBMS_UTILITY package. This package contains a port string procedure which returns the OS of the database server. Please keep in mind that this is different from the client’s OS (e.g. SQL*Plus session from which we are connecting to the database server). Following is the small code snippet, which displays the OS of the database server.

DECLARE
v_os VARCHAR(100);
BEGIN
V_OS := dbms_utility.port_String;
dbms_output.put_line(v_os);
END;
/

Here is the output.

IBMPC/WIN_NT-8.1.0

PL/SQL procedure successfully completed.

We are running our database on windows server and hence it showed as WIN_NT.

Sorry, the comment form is closed at this time.

 
%d bloggers like this: