[英]Perl DBD::Oracle Module installation
Could someone guide me how to install the Perl DBD::Oracle
module?有人可以指导我如何安装 Perl
DBD::Oracle
模块吗?
Here is what I have done so far:这是我到目前为止所做的:
$ORACLE_HOME
and $LD_LIBRARY_PATH
$ORACLE_HOME
和$LD_LIBRARY_PATH
Then when I do perl Makefile.pl
it fails with the following error:然后,当我执行
perl Makefile.pl
它失败并出现以下错误:
I'm having trouble finding your Oracle version number... trying harder WARNING: I could not determine Oracle client version so I'll just default to version 8.0.0.0. Some features of DBD::Oracle may not work. Oracle version based logic in Makefile.PL may produce erroneous results. You can use "perl Makefile.PL -V XYZ" to specify a your client version. Oracle version 8.0.0.0 (8.0) DBD::Oracle no longer supports Oracle client versions before 9.2 Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 271.
The instant client version: 11.1.0即时客户端版本:11.1.0
DBD::Oracle
version is 1.44 DBD::Oracle
版本是 1.44 If you have installed successfully with the Oracle instant client, then could you please let me know what am I missing?如果您已成功安装 Oracle 即时客户端,那么您能否告诉我我缺少什么?
Is it possible to install DBD::Oracle
without using the Oracle instant client?是否可以在不使用 Oracle 即时客户端的情况下安装
DBD::Oracle
?
sudo yum install perl-ExtUtils-MakeMaker
)sudo yum install perl-ExtUtils-MakeMaker
( sudo yum install perl-ExtUtils-MakeMaker
)$ yum install perl-DBI
)$ yum install perl-DBI
) Manually install below three RPMs for Oracle instant client (from Instant Client Downloads for Linux x86-64 . The example is for v11.2.0.3.0-1: adapt the commands below to the actual version.)为 Oracle 即时客户端手动安装以下三个 RPM(来自Instant Client Downloads for Linux x86-64 。示例适用于 v11.2.0.3.0-1:将以下命令调整为实际版本。)
oracle-instantclient11.2-basic-11.2.0.3.0-1 oracle-instantclient11.2-devel-11.2.0.3.0-1 oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I am using 64 bit Linux box, so select your RPM filenames accordingly.我使用的是 64 位 Linux 机器,因此请相应地选择您的 RPM 文件名。 Something like
sudo yum -y install oracle-instantclient*rpm
should do)像
sudo yum -y install oracle-instantclient*rpm
这样的东西应该做)
set below variables:设置以下变量:
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib export ORACLE_HOME=/usr/lib/oracle/11.2/client64
MacOS users will need: MacOS 用户需要:
DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/
Also add ORACLE_HOME
to your PATH
variable. ORACLE_HOME
添加到您的PATH
变量中。
untar the module and run below commands in given sequence:解压模块并按给定顺序运行以下命令:
perl Makefile.PL make sudo make install
In case you get complaints about missing gcc you can (temporarily) install it and then remove it.如果您收到有关缺少 gcc 的投诉,您可以(暂时)安装它然后将其删除。
DONE !!!完毕 !!!
Issues I had faced were due to the wrong LD_LIBRARY_PATH
.我遇到的问题是由于错误的
LD_LIBRARY_PATH
。 I had set it to /usr/lib/oracle/11.2/client64
whereas the correct value is /usr/lib/oracle/11.2/client64/lib
.我已将其设置为
/usr/lib/oracle/11.2/client64
而正确的值是/usr/lib/oracle/11.2/client64/lib
。
Certainly, this was a great learning for a newbie like me.当然,这对于像我这样的新手来说是一次很好的学习。
you can also read my article How to install DBD::Oracle which contains all the steps required to install DBD::Oracle CPAN module, which is not a straightforward installation.您还可以阅读我的文章如何安装 DBD::Oracle ,其中包含安装 DBD::Oracle CPAN 模块所需的所有步骤,这不是一个简单的安装。 The purpose is to reduce headache and turn it into a repeatable process.
目的是减少头痛并将其变成可重复的过程。
Here's what I did on CentOS 7.2 using yum packages and CPAN.这是我使用 yum 包和 CPAN 在 CentOS 7.2 上所做的。 This assumes you're using Oracle version 12.1 but I would imagine most versions will work this way.
这假设您使用的是 Oracle 12.1 版,但我想大多数版本都会以这种方式工作。
Install Oracle Instant Client安装 Oracle 即时客户端
yum install oracle-instantclient12.1-basic-12.1.0.2.0-1 oracle-instantclient12.1-devel-12.1.0.2.0-1 oracle-instantclient12.1-sqlplus-12.1.0.2.0-1
Copy demo make files复制演示制作文件
The install expects the *.mk file to be in /usr/share/oracle/12.1/client64 but the yum package install puts them in /usr/share/oracle/12.1/client64/demo.安装期望 *.mk 文件在 /usr/share/oracle/12.1/client64 中,但 yum 包安装将它们放在 /usr/share/oracle/12.1/client64/demo 中。
sudo cp /usr/share/oracle/12.1/client64/demo/* /usr/share/oracle/12.1/client64
Modify .bashrc修改 .bashrc
Add the following lines to your ~/.bashrc将以下行添加到您的 ~/.bashrc
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export PATH=$ORACLE_HOME:$PATH
Now source the file现在获取文件
source ~/.bashrc
Update CPAN and DBI更新 CPAN 和 DBI
Update CPAN and DBI to the latest将 CPAN 和 DBI 更新到最新
cpan> install CPAN
cpan> reload cpan
cpan> install DBI
Install DBD::Oracle安装 DBD::Oracle
cpan> install DBD::Oracle
A little addition to slayedbylucifer answer. slayedbylucifer 答案的一点补充。 I had the same problem like mentioned in the question.
我遇到了与问题中提到的相同的问题。 I've done all the steps described by slayedbylucifer.
我已经完成了 slayedbylucifer 描述的所有步骤。 But still I got the problem like mentioned here :
但我仍然遇到了这里提到的问题:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /opt/oracle/app/oracle/product/11.2.0/client_1/lib//libclntsh.so when searching for -lclntsh
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lclntsh
So I created the following symbolic link:所以我创建了以下符号链接:
ln -s /opt/oracle/app/oracle/product/<YOUR_ORACLE_VERSION>/client_1/lib/libclntsh.so $ORACLE_HOME/libclntsh.so*
After that step the error from above (cannot find -lclntsh) was fixed.在那一步之后,上面的错误(找不到 -lclntsh)被修复了。 The execution of the make command was without any errors.
make 命令的执行没有任何错误。
The only problem I still have is that I don't understand why this symbolic link is necessary.我仍然遇到的唯一问题是我不明白为什么这个符号链接是必要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.