SheridanCat has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that uses DBD::Oracle and runs on a RH Linux box. The Oracle client is installed and SQL*Plus runs fine. The script runs fine if I'm running it interactively from the CLI. I have it also setup as a cron job, and that's failing with this 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: libclntsh.so.10.1: 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.

I've search here and found references to permissions being an issue. I've taken that advice and made sure the directory with the Oracle.so is owned by group "oracle" and user "oinstall" and I've set the permissions to 755. Still no dice though. Are there any other words of wisdom anyone might have on this? Other searches, Google specificaly, haven't been helpful so far.

Replies are listed 'Best First'.
Re: DBD::Oracle - Shared Object Problem
by jhourcle (Prior) on Jul 10, 2006 at 17:56 UTC

    You're mentioned that you fixed Oracle.so, but did you also make sure to check that libclntsh.so.10.1 is in a place where it's going to be found by the running cron job?

    Hint -- make sure that oraenv is run by the cron job or that ORACLE_HOME and whatever other variables are set. See Oracle's instructions for PHP troubleshooting

Re: DBD::Oracle - Shared Object Problem
by rev_1318 (Chaplain) on Jul 10, 2006 at 20:22 UTC
    It's always the same: please realise that your environment (ORACLE_HOME, PATH, etc.) does NOT exist when running a cron job. You have to set your environment up yourself

    Paul

Re: DBD::Oracle - Shared Object Problem
by chanakya (Friar) on Jul 11, 2006 at 07:27 UTC
    Hi SheridanCat

    I faced with the similar issue some time back and came up with the following solution, which is working till now
    Insert the following into the BEGIN {} blocks
    BEGIN { $ENV{'ORACLE_HOME'} = '/opt/oracle/OraHome1'; $ENV{'LD_LIBRARY_PATH'} = '/opt/oracle/OraHome1/lib'; }
    Hope this helps