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

Document ID : KB000034400
Last Modified Date : 14/02/2018
Show Technical Document Details

Problem:
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).

Resolution:
Check the oracle probe Release Notes in the Nimsoft online archive
(http://support.nimsoft.com), and click on the Archive and find the probe and open the Release Notes to see which Oracle clients are currently supported.

You can also check the oracle Help docs for probe requirements at:

http://docs.nimsoft.com/prodhelp/en_US/Probes/Catalog/oracle/4.5/index.htm?toc.htm?2103970.html?zoom_highlight=oracle

or

https://wiki.ca.com/display/UIMPGA/oracle+%28Oracle+Database+Monitoring%29+Release+Notes

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.

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 REQUIRES the LIBPATH as well. Please see latest release notes.
 

Example settings for the environment variables:

 
Example how to find Values:

[root@masru01-natura-oracle ~]# su - oracle
[oracle@masru01-natura-oracle ~]$ 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). 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)

User-added image

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)

User-added image

oracle probe Release Notes:
https://wiki.ca.com/rest/ca/product/latest/topic?format=rendered&language=&space=UIMPGA&hid=oracle_RN


keywords: Create OCI environment failed rc = -1 OCIEnvCreate unable connect Oracle server error alarm Test fails failed difficult difficulty configuring probe complex