开发者

dbi::Oracle error while running from cron

Hi I am using DBD::Oracle in my script to query into oracle database. When I am running this script its working fine but when i schedule to run thi开发者_运维知识库s from cron its giving below error

install_driver(Oracle) failed: Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libnnz10.so: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
 at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
 at /scripts/db/dbquery.pl line 50

Line 50 is:

my $dbh = DBI->connect("dbi:Oracle:$tns","$dbuser","$dbpass");

Please suggest, how to fix this.


Does sound like the required Oracle environment variables have not been set for cron (re: ysth comment to amphetamachine answer).

Have a look at this answer to SO question: How can I use a database server from a Perl CGI script? for some guidance.

To help, see what Oracle ENV variables you have set in your login profile:

env | grep -i oracle

Pretty much all what you see here should be set as $ENV{} variables in your Perl script or depending on version of cron you are running it could also be added to your crontab file:

ORACLE_HOME=/home/oracle/product/10.x.x
* * * * * /path/to/your/script.pl

/I3az/


Looks like you may need to install Oracle client libraries in order for this to work. libnnz10.so, which needs to be dynamically loaded by the module, is apparently part of the install.

Of note is that Oracle is proprietary and not GPL-compliant, therefore almost no Linux distro will make it available through their repository. This means you are probably going to have to install it yourself.

Edit: Make sure LD_CONFIG_PATH points to the directory where the library resides.

Alternately, you could just append a line to /etc/ld.so.conf with the path to the Oracle client libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜