我执行了下面的perl脚本,
#!/usr/bin/perl
use strict;
use DBD::Oracle;
use DBI;
my $driver = "Oracle";
my $database = "host=xxxxxx;port=6210;sid=xxxx";
my $dsn = "DBI:$driver:$database";
my $userid = "xxxxx";
my $password = "xxxxx";
#Database Connection
my $dbh = DBI->connect($dsn, $userid, $password,{RaiseError => 1}) or die "$DB::errstr";
my $sth = $dbh->prepare("update collabuser set user_email='aravikum.wipro.com' where user_login='aravikum'") or die "$DBI::errstr";
$sth->execute() or die "couldn't execute statementn$!";
$sth->rows;
#End of Program
$sth->finish();
$dbh->disconnect();
我收到了以下错误:
Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libocci.so.11.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
at perlupdt.pl line 11.
Compilation failed in require at perlupdt.pl line 11.
BEGIN failed--compilation aborted at perlupdt.pl line 11.
在谷歌搜索,我得到一个答案,如运行以下导出命令修复了问题。所以,我执行并且工作正常,
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib/oracle/11.2/client64/bin:$PATH
但是,我每次登录putty时都无法执行上述命令,
我决定将此导出放在脚本中,因此在脚本的开头添加了这些
$ENV{"ORACLE_HOME"} = '/usr/lib/oracle/11.2/client64';
$ENV{"LD_LIBRARY_PATH"} = '/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH';
$ENV{"PATH"} = '/usr/lib/oracle/11.2/client64/bin:$PATH';
但是我收到了上述错误,请建议在perl脚本中导入这些命令的解决方案。
答案 0 :(得分:1)
在etc / profile和etc / bashrc中设置以上导出命令并在etc / profile.d下添加为.sh文件后,此问题已解决。