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 this 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:
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:
/I3az/