Perl DBD::Oracle 模块安装

2021-12-10 00:00:00 perl oracle

有人可以指导我如何安装 Perl DBD::Oracle 模块吗?

Could someone guide me how to install the Perl DBD::Oracle module?

这是我目前所做的:

  • 平台:RHEL 5.8 64 位
  • 已安装 Perl DBI 包
  • 为 Linux 64 位安装了 Oracle Instant 客户端(即时客户端的基础 + sdk + sqlplus 组件
  • 已设置正确的$ORACLE_HOME$LD_LIBRARY_PATH
  • 然后当我执行 perl Makefile.pl 时它失败并出现以下错误:

  • Platform: RHEL 5.8 64 bit
  • Installed Perl DBI package
  • Installed Oracle Instant client for Linux 64 bit (basi + sdk + sqlplus component for the instant client
  • Have set the correct $ORACLE_HOME and $LD_LIBRARY_PATH
  • Then when I do perl Makefile.pl it fails with the following error:

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 X.Y.Z" 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.

  • 即时客户端版本:11.1.0

  • The instant client version: 11.1.0

    如果您已经成功安装了 Oracle 即时客户端,那么能否请您告诉我我缺少什么?

    If you have installed successfully with the Oracle instant client, then could you please let me know what am I missing?

    是否可以在不使用 Oracle 即时客户端的情况下安装 DBD::Oracle?

    Is it possible to install DBD::Oracle without using the Oracle instant client?

    推荐答案

    • 如果缺少 ExtUtils-MakeMaker 模块则安装 (sudo yum install perl-ExtUtils-MakeMaker)
    • 安装 Perl DBI 模块 ($ yum install perl-DBI)
    • 为 Oracle 即时客户端手动安装以下三个 RPM(来自 适用于 Linux x86-64 的 Instant Client 下载.以 v11.2.0.3.0-1 为例:根据实际版本调整以下命令.)

      • Install if missing ExtUtils-MakeMaker module (sudo yum install perl-ExtUtils-MakeMaker)
      • Install Perl DBI module ($ 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-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
        

      • 我使用的是 64 位 Linux 机器,因此请相应地选择您的 RPM 文件名.像 sudo yum -y install oracle-instantclient*rpm 应该做的)

        I am using 64 bit Linux box, so select your RPM filenames accordingly. Something like sudo yum -y install oracle-instantclient*rpm should do)

        • 设置以下变量:

        • set below variables:

        export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
        export ORACLE_HOME=/usr/lib/oracle/11.2/client64
        

        MacOS 用户需要:

        MacOS users will need:

        DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/
        

        同时将 ORACLE_HOME 添加到您的 PATH 变量中.

        Also add ORACLE_HOME to your PATH variable.

        从 CPAN

        解压模块并按给定顺序运行以下命令:

        untar the module and run below commands in given sequence:

        perl Makefile.PL
        make
        sudo make install
        

        如果您收到关于缺少 gcc 的投诉,您可以(暂时)安装它然后将其删除.

        In case you get complaints about missing gcc you can (temporarily) install it and then remove it.

        完成!!!

        我遇到的问题是由错误的 LD_LIBRARY_PATH 引起的.我已将其设置为 /usr/lib/oracle/11.2/client64 而正确的值是 /usr/lib/oracle/11.2/client64/lib.

        Issues I had faced were due to the wrong 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.

        当然,这对像我这样的新手来说是一次很好的学习.

        Certainly, this was a great learning for a newbie like me.

  • 相关文章