ORA-DB-ONE

Using Oracle’s preinstalled perl DBD::Oracle library

Posted in Perl Scripts by jackyoon on December 21, 2011

Oracle started bundle perl DBD::Oracle with their software from version 10g. I used to install DBD::Oracle on each machine that I monitor oracle database through nagios but I started using preinstalled one and this is how you can do it.

The DBD::Oracle is located under ORACLE_HOME/perl/lib/site_perl//DBD. So, I set following two environment to use pre-installed library.

export PERL5LIB=$ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi:$PERL5LIB
export PATH=$ORACLE_HOME/perl/bin:$PATH

In addition to that we also need to use perl executable under ORACLE_HOME. So, it is recommended to change your existing script to use the perl under your environment variable instead of fixed /usr/bin/perl.

#!/usr/bin/env perl

Last, if you are using nrpe and want to check oracle database the you have to put below three environment variables in side nrpe(/etc/init.d/nrpe) auto start script.

export ORACLE_HOME=/home/app/oracle/product/11g
export PERL5LIB=$ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi:$PERL5LIB
export PATH=$ORACLE_HOME/perl/bin:$PATH
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.