Ocsinventory::Agent::Modules::Databases::Oracle::Instances(3pm)

NAME
Oracle::Instances - Lib for Oracle instances and versions retrieval

DESCRIPTION
This module provides a function to retrieve information about Oracle instances on the current server.

To do so, the function reads the /etc/oratab file to find instances and then:

1.  Checks the existence of the ORACLE_HOME directory.

2.  Add (ORACLE_SID, ORACLE_HOME, AUTOSTART) to the databases hash.

3.  Go and find server version and bundle for each ORACLE_HOME.

    This information is found by executing the "tnsping" command and by reading the following XML file:

     $ORACLE_HOME/inventory/Components21/oracle.server/*/context.xml

    The following bundles are known: SE1 (Standard Edition One), SE (Standard Edition), EE (Enterprise Edition), XE (Express Edition).

4.  Returns the database hash as follows:

     {
         'SID' => {
             'BUNDLE' => 'Standard',
             'AUTOSTART' => 0,
             'ORA_HOME' => '/home/oracle/oracle/product/11.2.0',
             'VERSION' => '11.2.0.4.0'
         }
     };

Optionally, you can call getInstances() to return only the hash of versions and bundles, instead of the complete instances hash:

 {
     '/home/oracle/oracle/product/11.2.0' => {
         'BUNDLE' => 'Standard',
         'VERSION' => '11.2.0.4.0'
     }
 };

In that case, you just have to pass parameter 1 (integer one) when calling the function.

  Exports
The module exports the getInstances() function.

  getInstances()
Synopsis

    getInstances($version_only)

where $versions_only is a integer (tested as a bool)

    my $database = getInstances()
    my $versions = getInstances(1)

Return values

The function returns a hash reference containing the instances or versions.