Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Friday, October 5, 2007

How OUI and OPatch detect the platform that they are running on

OUI and OPatch both use the Java classes provided in the OraInstaller.jar file

The location of this JAR file depends on which version of OUI you are using, but is normally under OUI_location/jlib (for example, $ORACLE_HOME/oui/jlib)

The oracle.sysman.oii.oiix.OiixPlatform.class file in OraInstaller.jar includes the following code:

private static void checkSysProps()
{
if(s_forcedPlat == null)
s_forcedPlat = System.getProperty("oracle.installer.platform", "");
if(s_osname == null)
s_osname = System.getProperty("os.name", "");
if(s_osarch == null)
s_osarch = System.getProperty("os.arch", "");
if(s_osver == null)
s_osver = System.getProperty("os.version", "");
if(s_osdatamodel == null)
s_osdatamodel = System.getProperty("sun.arch.data.model", "");
}


@
@ System.getProperty("os.name","") gets the same output as "uname -s"
@
@ System.getProperty("os.arch","") gets the output from Unix system
@ call sysconf(_SC_CPU_VERSION) and then looks up the architecture in
@ /usr/include/sys/unistd.h (on HPUX - check the other platforms!)
@
@ Another way of looking at it is that it runs "getconf CPU_VERSION",
@ converts the decimal result to hex and then looks up the architecture
@ in /usr/include/sys/unistd.h
@
@ System.getProperty("os.version","") gets the same output as "uname -r"
@

From this we can see that OUI calls the Java function System.getProperty()

The results are passed back to OUI (or OPatch).

An easy way to check this, without using OUI or OPatch, is to follow these steps:

1) Create a Java program called platform.java like this:

public class platform {
public static void main (String[] args) {
System.out.print("Operating System: ");
System.out.println(System.getProperty("os.name"));
System.out.print("Operating System version: ");
System.out.println(System.getProperty("os.version"));
System.out.print("System Architecture: ");
System.out.println(System.getProperty("os.arch"));
}
}

2) Compile the program like this:

javac platform.java

3) Run the program like this:

java platform


Here is some example output:

SOLARIS 2.6 (32-bit)
====================
Operating System: SunOS
Operating System version: 5.6
System Architecture: sparc

SOLARIS 8 (32-bit or 64-bit)
============================
Operating System: SunOS
Operating System version: 5.8
System Architecture: sparc

HPUX 11.0 (64-bit)
==================
Operating System: HP-UX
Operating System version: B.11.00
System Architecture: PA-RISC

HPUX 11.11 (64-bit)
===================
Operating System: HP-UX
Operating System version: B.11.11
System Architecture: PA-RISC

HPUX 11.22 (IA64)
=================
Operating System: HP-UX
Operating System version: B.11.22
System Architecture: IA64

AIX 4.3.3 (64-bit)
==================
Operating System: AIX
Operating System version: 4.3
System Architecture: POWER_PC

AIX 5L 5.2 (64-bit)
===================
Operating System: AIX
Operating System version: 5.2
System Architecture: POWER_PC

TRU64 5.1B (64-bit)
===================
Operating System: OSF1
Operating System version: V5.1
System Architecture: alpha

REDHAT 2.1 (x86 32-bit)
=======================
Operating System: Linux
Operating System version: 2.4.9-e.25enterprise
System Architecture: x86

REDHAT 3.0 (x86 32-bit)
=======================
Operating System: Linux
Operating System version: 2.4.21-4.EL
System Architecture: i386

REDHAT 3.0 (x64-64 64-bit)
==========================
Operating System: Linux
Operating System version: 2.4.21-4.EL
System Architecture: i386
@ Is the architecture right here ?

This is not a complete list - it is just supposed to give you an idea of the output to expect.

Source: Unpublished Metalink Note 292628.1

2 comments:

amihay gonen said...

Hi , nice information.

I wander if there an API of opatch to retrive the output of opatch -lsinventory

Vikram Das said...

Hi amihay,

If you look inside opatch shell script, it actually calls java classes:

Line 189 of opatch shell script reads:

$JAVA -cp $CP/OraInstaller.jar:$CP/xmlparserv2.jar:$CP/share.jar:$CP/srvm.jar:$BASE/jlib/opatch.jar:$BASE/jlib/opatchutil.jar:$BASE/jlib/opatchprereq.jar: -DOPatch.ORACLE_HOME=$OH -DOPatch.DEBUG=$DEBUGVAL oracle/opatch/OPatch $@

If you are interested in digging deeper, you may have to go through the class files inside the jar files

- Vikram