create shell script, first set enviroment variables Oracle then execute script perl

jonathan.leff...@gmail.com escribió:
The dynamic loader read LD_LIBRARY_PATH when (before?) Perl gets going.  AFAIK, 
it doesn't reread it,  so changing it in Perl code is too late unless you set 
it and exec your code again (which is basically saying it is too late).

I'm tolerably certain this applies to Solaris; I think it applies elsewhere too.

JL


Sent from my BlackBerry® smartphone, powered by CREDO Mobile.

-----Original Message-----
From: newbie01 perl <newbie01.p...@gmail.com>
Date: Fri, 28 May 2010 19:45:14 To: beginners<beginn...@perl.org>; dbi-users<dbi-users@perl.org>
Subject: How to set LD_LIBRARY_PATH

Hi all,

Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts?

If I set LD_LIBRARY_PATH from the command line, all is okay

[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";'
Can't load
'/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: libclntsh.so.11.1: cannot open shared object file:
No such file or directory at
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at -e line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
[oracle ~]$ export LD_LIBRARY_PATH=/oracle/product/db/11.1/lib
[oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";'
1.15

But if I do the following instead in the Perl script, it does not work? How
to set the LD_LIBRARY_PATH then?

$ENV{ORACLE_HOME}=$ORACLE_HOME;
$ENV{ORACLE_SID}=$ORACLE_SID;
$ENV{PATH}="$ORACLE_HOME/bin:$PATH";
$ENV{LD_LIBRARY_PATH}="$ORACLE_HOME/lib";

FYI, the script is to run from a cron which is why am setting
LD_LIBRARY_PATH in the script.

Any response will be very much appreciated. Thanks in advance.


Reply via email to