oracle probe connection error Create OCI environment failed or OCIEnvCreate failed with rc = -1
search cancel

oracle probe connection error Create OCI environment failed or OCIEnvCreate failed with rc = -1

book

Article ID: 34400

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM) CA Unified Infrastructure Management On-Premise (Nimsoft / UIM) CA Unified Infrastructure Management SaaS (Nimsoft / UIM)

Issue/Introduction

If testing a connection in the oracle probe is failing with an error message such as: "Create OCI environment failed with rc = -1" or "OCIEnvCreate failed with rc = -1" follow the instructions below.

OCIEnvCreate returning -1 almost always indicates that the probe cannot find the oracle client (or doesn't have read/execute permissions).

Environment

  • Any UIM Version
  • Any Oracle probe version

Resolution

Check the oracle probe Release Notes to see which Oracle clients are currently supported and requirements.

https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/it-operations-management/ca-unified-infrastructure-management-probes/GA/alphabetical-probe-articles/oracle-oracle-database-monitoring/oracle-oracle-database-monitoring-release-notes.html#concept.dita_03df114cfbf63df6852ce5ad3b91546626756a5f_OracleSupportedVersionsandClients

The first piece of information you should collect is whether the oracle_monitor probe is deployed on the same machine where the database is installed or on a different machine. If the probe is installed on a different machine then verify which 'Oracle Client' version is installed on that machine locally, and check the OS version for that server and whether the OS is 32 or 64-bit.

If customer is using zones ensure that the client and server are on the same zone even when they are on the same server.

The Release Notes for the Oracle probe contain a matrix listing the different combinations of Server and Client versions that are officially supported by the oracle probe. If you have any other version of the Oracle Client other than what is supported with your Server version then please update it to one that is officially supported.

The oracle probe requires that the Oracle client 'match' the OS (32-bit versus 64-bit) and Oracle DB server version. If you have a 64-bit OS you are running the probe on. then the Oracle client must be 64-bit as well.

Also, you will need to double-check the items below after logging in with the oracle user (you must be logged in as the oracle user instead of root)

1. Re-verify that the following variables are set on the machine where the Oracle database is installed.

   a. ORACLE_HOME
   b. ORACLE_BASE
   c. ORACLE_SID
   d. PATH (should include the Oracle bin directory.)
   e. TNS_ADMIN
   f.  LD_LIBRARY_PATH

NOTE: AIX OS REQUIRES the LIBPATH as well. Please see the latest release notes.

Example settings for the environment variables

Example on how to find values:

[[email protected] ~]# su - oracle
[[email protected] ~]$ env |grep oracle
HOSTNAME=masru01-natura-oracle
USER=oracle
LD_LIBRARY_PATH=/home/oracle/11.2/database/lib:/lib:/usr/lib:/usr/lib64
ORACLE_BASE=/home/oracle
MAIL=/var/spool/mail/oracle
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/home/oracle/11.2/database/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
PWD=/home/oracle
HOME=/home/oracle
LOGNAME=oracle
ORACLE_HOME=/home/oracle/11.2/database

UIM Environment would be set as follows for the above:
ORACLE_HOME=/home/oracle/11.2/database
ORACLE_BASE=/home/oracle
ORACLE_SID= SIDID

PATH=/home/oracle/11.2/database/bin
TNS_ADMIN/home/oracle/11.2/database/network/admin
LD_LIBRARY_PATH=/home/oracle/11.2/database/lib 
LIBPATH=/home/oracle/11.2/database/lib                 ****( FOR AIX ONLY)*****
NLS_LANG=

You can run a command to check the default value set in that environment, e.g: #echo $ORACLE_SID, you can use similar commands with the echo command to check each one; or you can use the #env or set command to print all the env variables currently set in the shell environment.

2. Copy the Oracle OCI.DLL from the Oracle BIN folder to the Windows\System32\ folder

3. Make sure that you are able to run sqlplus commands through the command prompt and that you are able to connect to the database. Also, check that the oracle user has the proper rights/permissions.

4. On the machine where the oracle_monitor probe is installed please check that ORACLE_HOME, ORACLE_SID, and NLS_LANG are set properly in the Robot environment. You can check this on the controller->Setup->Environment tab.

On Windows platforms:
Set the ORACLE_HOME path to the directory where the client is installed.

For example, C:\oracle\product\10.2.0\client_1.

On UNIX or Linux platforms:
Set the ORACLE_HOME path to the directory where the client is installed. For example, /u01/app/oracle/product/10.2.0/client_1.
Set the ORACLE_SID path to the service identifier name that you configured by using the Oracle client.
Set the LD_LIBRARY_PATH path to the Oracle library directory. For example, /u01/app/oracle/product/10.2.0/client_1/lib.

Important: The Current Enforcing Mode must be Permissive on Linux Platform.

Follow these steps for setting the Current Enforcing Mode to Permissive:

Open SELinux Management.

The SELinux Administration window appears.
In the Current Enforcing Mode list, click Permissive.
Close the SELinux Administration window.

Troubleshooting:

Deactivate the probe and try running it from the command line, and see what happens. Verify that ORACLE_HOME as well as ORACLE_SID is set correctly e.g., by doing a 'set | grep ORACLE' or set|more, prior to running the probe.

Please also make sure that there is no local firewall enabled.
To check this enter the command:
 
service iptables status or service iptables stop to disable the firewall (Linux).

or

Stop firewalld for the current session->systemctl stop firewalld.service

Confirm Firewalld is inactive-> systemctl status firewalld

For a different OS, different commands may apply to do the same.


The Oracle client should work properly when the environment variables are set correctly and you should be able to run sqlplus and tnsping from the command line on the machine where the probe and oracle client is installed.

Make sure that the instance name, in the oracle probe, is consistent, e.g., follows capitalization rules. In one case, TNS named the instance MMALIVE, but in the probe configuration, it was mmalive. Set the probe to match TNS names and the ORACLE_SID in the controller environment.

Make sure you manually restart the Nimbus Robot Watcher service from Services manager in Windows (or using niminit stop and start on Unix/Linux), so the Robot environment variables are reloaded.

Miscellaneous PATH examples:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
export ORACLE_HOME

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

PATH=$PATH:$ORACLE_HOME/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin

For an Oracle database with multiple instances/SIDs, each SID must be configured for each connection profile in the probe/instance, Service Name and Instance must be specified.

Make sure you add TNS_ADMIN to the Robot controller environment. It is the location of the
tnsnames.ora, sqlnet.ora etc files, for example:

UNIX/LINUX
/XYZ/app/oracle/product/10.2.0/network/admin

Windows:
C:\oracle\product\11.1.0\client_1\network\admin

Confirm your LD_LIBRARY_PATH is also correct, e.g.,
/XYZ/app/oracle/product/10.2.0/lib:/XYZ/app/oracle/product/10.2.0/network/lib

Note that the oracle probe version 4.71 does not support AIX 6 and 7. You need 4.90 or higher.

See below for two screenshots of a sample configuration for the Robot/controller and Oracle connection settings for an Oracle probe installed on the local Oracle database server on an AIX 7.1 machine:

Robot/controller environment (example)




Excerpt from the Robot environment section on the machine where the probe is installed:

<environment>
      NLS_LANG =
      ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/db_1
      ORACLE_BASE = /u01/app/oracle
      LD_LIBRARY_PATH = /u01/app/oracle/product/11.2.0.4/db_1/lib
      PATH = $PATH:$ORACLE_HOME/bin
      TNS_ADMIN = $ORACLE_HOME/network/admin
   </environment>

Oracle probe Connection settings (example)

 



Attachments