获取错误 install_driver(Oracle) 失败:无法加载“/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25906850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
getting error install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so'
提问by kavuru
i am getting below error when trying to connect to database
尝试连接到数据库时出现以下错误
install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/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.8/x86_64-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
可能未在预期位置安装所需的共享库或 dll
回答by Steve Baroti
Please rebuild DBD::Oracle PERL module, making sure that you have all the ORACLE environment set-up on the machine, including ORACLE_HOME and LD_LIBRARY_PATH. $ORACLE_HOME folder contains these three important folders:
请重建 DBD::Oracle PERL 模块,确保您在机器上设置了所有 ORACLE 环境,包括 ORACLE_HOME 和 LD_LIBRARY_PATH。$ORACLE_HOME 文件夹包含以下三个重要文件夹:
ls -la $ORACLE_HOME
bin
lib
network
...
and it is defined as (please choose /adapt as needed):
它被定义为(请根据需要选择 /adapt):
ORACLE_HOME=/usr/lib/oracle/11.2/client64 (RHEL5, oracle-instantclient11.2-basic-11.2 rpm packages)
ORACLE_HOME=/usr/lib64/oracle/10.2.0.4/client64 (RHEL5, oracle-instantclient-basic-10.2.0.4 rpm packages)
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1 (Oracle 11g server installation)
And almost always:
并且几乎总是:
LD_LIBRARY_PATH=$ORACLE_HOME/lib
(this is the folder where the "libclntsh.so.11.1" file is located!! and this LD_LIBRARY_PATH path will help PERL DB::Oracle module to find it!)
(这是“libclntsh.so.11.1”文件所在的文件夹!!并且这个LD_LIBRARY_PATH路径将帮助PERL DB::Oracle模块找到它!)
Below is an example for user environment set-up on a server with a Oracle 11g server:
以下是在带有 Oracle 11g 服务器的服务器上设置用户环境的示例:
cat /etc/profile.d/oracle-profile.sh
ORACLE_OWNER=oracle
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/app/oracle
PATH=$PATH:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_OWNER ORACLE_HOME ORACLE_BASE PATH LD_LIBRARY_PATH
I hope it helps.
我希望它有帮助。
回答by TontonZition
1) find where is Oracle.so (you can use locate commande)
1)找到Oracle.so在哪里(你可以使用locate commande)
-> locate Oracle.so
-> 找到 Oracle.so
-> xxxxxx/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle
-> xxxxxx/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle
2) modify the scrip Perl :
2) 修改脚本 Perl :
use lib "xxxxxxx/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle/";
使用 lib "xxxxxxx/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle/";
so Compilation knows where is Oracle.so
所以编译知道Oracle.so在哪里