Search
Support Technical Information How-To check_oracle with Oracle Instant Client

check_oracle with Oracle Instant Client

 
 
Introduction

This how-to paper describe how to setup your op5 Monitor server with Oracle Instant Client to be able to use check_oracle directly towards the Oracle Database.

This means we eliminate the use of 3rd party agents on the server, and it's the same syntax for Linux/UNIX and Windows platforms.

In this paper we will use version 11.1.0.6.0 of Oracle Instant Client.

The word '<shell>#' means that you will need to type a command.

 
 
Requirements
  • op5 Plugins 2.2.7 Installed (Released 2008-05-14)
  • You need to create an account on Oracle Homepage to be able to download the files need for this installation.
 
 
Links

Oracle Create Account:
http://www.oracle.com/admin/account/index.html
Oracle Instant Client:
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
DBD:Oracle;
http://search.cpan.org/~pythian/DBD-Oracle-1.20/Oracle.pm
 

 
 
Oracle Instant Client

Download the following files from the Oracle Instant Client.

  • Choose Version: Version 11.1.0.6.0
  • Instant Client Package - Basic: basic.zip
  • Instant Client Package - SQL*Plus: sqlplus.zip
  • Instant Client Package - SDK: sdk.zip

Login to the Monitor Server

Setting Environment variables:
Create a new file in /etc/profile.d call it check_oracle.sh

check_oracle.sh:
ORACLE_HOME=/opt/oracle/instantclient_11_1
TNS_ADMIN=/opt/oracle/instantclient_11_1/network/admin
LD_LIBRARY_PATH=/opt/oracle/instantclient_11_1
export ORACLE_HOME TNS_ADMIN LD_LIBRARY_PATH

Disconnect from the server and login again or type:

<shell># . /etc/profile.d/check_oracle.sh

Verify that your environment parameters is correct:

<shell># echo $ORACLE_HOME
<shell># echo $TNS_ADMIN
<shell># echo $LD_LIBRARY_PATH

If everything is looking OK we install "Oracle Instant Client"

<shell># mkdir -p $TNS_ADMIN
<shell># cd /opt/oracle
<shell># unzip /root/basic.zip
<shell># unzip /root/sqlplus.zip
<shell># unzip /root/sdk.zip
<shell># ln -s $ORACLE_HOME/sqlplus /usr/bin/sqlplus
<shell># touch $TNS_ADMIN/sqlnet.ora
<shell># touch $TNS_ADMIN/tnsnames.ora

Edit your tnsnames.ora according to your Oracle Environment. (Ask your Oracle Admin for help)

sample tnsnames.ora:
OP5= (DESCRIPTION =
        (ADDRESS_LIST =
                (ADDRESS = (PROTOCOL = TCP)
		(HOST = oracle.int.op5.se)(PORT = 1521)))
 (CONNECT_DATA =
        (SID = op5)))

If everything works OK you should be able to connect to you db with the following command.

<shell># sqlplus <user>/<password>@op5
 
 
Perl support

To write own plugins and use DBI to connect to Oracle you need to have all the above steps working.
Download DBD:Oracle from CPAN. http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.20.tar.gz

<shell># cd /root
<shell># wget \
http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.20.tar.gz
<shell># tar xvzf DBD-Oracle-1.20.tar.gz
<shell># cd DBD-Oracle-1.20
<shell># perl Makefile.PL
<shell># make && make install

DBI support with DBD:Oracle is now installed.

Note: not required for check_oracle.pl
 
 
Getting tnsping to work

!! The following steps are not supported by op5 or Oracle, we will not take responsibility for any of these steps. !!

To get tnsping to work you have to copy tnsping and tnsus.msb from an existing Linux Oracle installation, preferably from an RedHat 4/5 Installation. put the file in $ORACLE_HOME.

place tnsping in /opt/oracle/instantclient_11_1/tnsping
place tnsus.msb in /opt/oracle/instantclient_11_1/network/mesg/tnsus.msb
(Make sure you have read permission to tnsus.msb for user "monitor")

Create symlinks to get tnsping to work:

<shell># ln -s $ORACLE_HOME/tnsping /usr/bin/tnsping
<shell># cd /opt/oracle/instantclient_11_1
<shell># ln -s libclntsh.so.11.1 libclntsh.so.10.1
<shell># ln -s libnnz11.so libnnz10.so
Verify that your tnsping is working.
<shell># tnsping op5
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = \
(PROTOCOL = TCP)(HOST = oracle.int.op5.se)(PORT = 1521))) \
(CONNECT_DATA = (SID = op5)))
OK (40 msec)
 
 
Last Updated ( Wednesday, 29 October 2008 16:02 )