安装 DBD::Oracle 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26200174/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:33:06  来源:igfitidea点击:

Error while installing DBD::Oracle

linuxoracleperlcpan

提问by Mandar Shinde

I am trying to install Perl module DBD::Oracle on my RHEL6.1 server. While doing so, I followed following steps:

我正在尝试在我的 RHEL6.1 服务器上安装 Perl 模块 DBD::Oracle。在这样做的同时,我遵循了以下步骤:

  1. Installation of following RPMs:

    • oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
    • oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
    • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
  2. Exporting environment variables

    export ORACLE_HOME=/usr/lib/oracle/12.1/client64

    export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib

  3. Installing DBD::Oracle

    cpan -i DBD::Oracle

  1. 安装以下 RPM:

    • oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
    • oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
    • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
  2. 导出环境变量

    export ORACLE_HOME=/usr/lib/oracle/12.1/client64

    export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib

  3. 安装 DBD::Oracle

    cpan -i DBD::Oracle

While doing so, it gives following error message:

这样做时,它会给出以下错误消息:

Installing on a linux, Ver#2.6
Using Oracle in /usr/lib/oracle/12.1/client64
DEFINE _SQLPLUS_RELEASE = "1201000200" (CHAR)
Oracle version 12.1.0.2 (12.1)

        Unable to locate an oracle.mk or other suitable *.mk
        file in your Oracle installation.  (I looked in
        /usr/lib/oracle/12.1/client64/rdbms/demo/demo_xe.mk /usr/lib/oracle/12.1/client64/rdbms/lib/oracle.mk /usr/lib/oracle/12.1/client64/rdbms/demo/oracle.mk /usr/lib/oracle/12.1/client64/rdbms/demo/demo_rdbms.mk /usr/lib/oracle/12.1/client64/rdbms/demo/demo_rdbms64.mk /usr/lib/oracle/12.1/client64/rdbms/lib/ins_rdbms.mk /usr/share/oracle/12.1/client64/demo.mk under /usr/lib/oracle/12.1/client64)

        The oracle.mk (or demo_rdbms.mk) file is part of the Oracle
        RDBMS product.  You need to build DBD::Oracle on a
        system which has one of these Oracle components installed.
        (Other *.mk files such as the env_*.mk files will not work.)
        Alternatively you can use Oracle Instant Client.

        In the unlikely event that a suitable *.mk file is installed
        somewhere non-standard you can specify where it is using the -m option:
                perl Makefile.PL -m /path/to/your.mk

        See the appropriate README file for your OS for more information and some alternatives.

     at Makefile.PL line 1187.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
  PYTHIAN/DBD-Oracle-1.74.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

What's wrong with the installation process? I followed thisguide.

安装过程有什么问题?我遵循了指南。

回答by Miguel Prz

After the installation and setup of the Oracle Instant Client, use the normal build steps without the cpan tool, and pass the -loption to the Makefile.PL

在安装和设置 Oracle Instant Client 后,使用没有 cpan 工具的正常构建步骤,并将-l选项传递给 Makefile.PL

  1. Download the tar.gzpackage and unpack it

  2. Build it

    perl Makefile.PL -l
    make && make test
    
  3. Install

    make install
    
  1. 下载安装tar.gz包并解压

  2. 建造它

    perl Makefile.PL -l
    make && make test
    
  3. 安装

    make install
    

回答by QuickFix

Actually if you want to use the rpms and cpan to install, you have to set ORACLE_HOME to the lib folder, not just client64 and add sqlplus to the path :

其实如果你想使用rpms和cpan来安装,你必须将ORACLE_HOME设置为lib文件夹,而不仅仅是client64,并将sqlplus添加到路径中:

export ORACLE_HOME=/usr/lib/oracle/12.1/client64/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/12.1/client64/lib/
export PATH=$PATH:/usr/lib/oracle/12.1/client64/bin

with that cpan -i DBD::Oraclereturns no error.

cpan -i DBD::Oracle回报没有错误。

回答by chadclan

The only thing the CPAN installer can't find is a suitable *.mk file. Oracle must be playing a game of cat and mouse with the CPAN installer because the installer is searching in several locations for several filenames.

I used the command

CPAN 安装程序唯一找不到的是合适的 *.mk 文件。Oracle 一定是在用 CPAN 安装程序玩猫捉老鼠的游戏,因为安装程序正在多个位置搜索多个文件名。

我使用了命令

locate -r '\.mk$'

to find that demo.mk is now located in /usr/lib/oracle/12.1/client64/demo/instead of /usr/lib/oracle/12.1/client64/

So I created a symbolic link

找到 demo.mk 现在位于/usr/lib/oracle/12.1/client64/demo/而不是/usr/lib/oracle/12.1/client64/

所以我创建了一个符号链接

sudo ln -s /usr/share/oracle/12.1/client64/demo/demo.mk /usr/share/oracle/12.1/client64/demo.mk

and the CPAN installer succeeded.

并且 CPAN 安装程序成功。

回答by TheParanoidAndroid

I was able to use CPAN to install DBD::Oracle for 11.2.0.4 by installing the following 3 instant client RPM packages:

通过安装以下 3 个即时客户端 RPM 包,我能够使用 CPAN 为 11.2.0.4 安装 DBD::Oracle:

  • oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64
  • oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64
  • oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64
  • oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64
  • oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64
  • oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64

Once I got those installed, cpan was able to build. This is with CentOS 7.3.1611.

一旦我安装了这些,cpan 就可以构建了。这是 CentOS 7.3.1611。

回答by Алексей Штыков

Before you begin you need to:

在开始之前,您需要:

  • Download Oracle 12c instant client and SDK:

    • instantclient-basic-linux.x64-12.2.0.1.0.zip
    • instantclient-sdk-linux.x64-12.2.0.1.0.zip
    • instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
  • Install with the command:

    sudo apt-get install libaio1

  • Download and unwrap DBD::Oracle package witn the command:

    cpan get DBD::Oracle

  • 下载 Oracle 12c 即时客户端和 SDK:

    • Instantclient-basic-linux.x64-12.2.0.1.0.zip
    • Instantclient-sdk-linux.x64-12.2.0.1.0.zip
    • Instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
  • 使用以下命令安装:

    sudo apt-get install libaio1

  • 使用以下命令下载并解包 DBD::Oracle 包:

    cpan get DBD::Oracle

If you've got DBD::Oracle 1.74 + Oracle 12c (12.2.0.1) and Ubuntu 18 Application under Windows 10 then you need more changes.

如果您在 Windows 10 下安装了 DBD::Oracle 1.74 + Oracle 12c (12.2.0.1) 和 Ubuntu 18 应用程序,那么您需要进行更多更改。

  1. Comment row 1613 in Makefile.PL

    #local $ENV{PATH} = join $Config{path_sep}, "$OH_path/bin", $OH_path, $ENV{PATH} if $OH;

  2. Replace row 1630

    my $sqlplus_release = `sqlplus -S /nolog \@define.sql`;

  1. Makefile.PL 中的第 1613 行注释

    #local $ENV{PATH} = join $Config{path_sep}, "$OH_path/bin", $OH_path, $ENV{PATH} if $OH;

  2. 替换第 1630 行

    我的 $sqlplus_release = `sqlplus -S /nolog \@define.sql`;

with the rows

与行

my $sqlplus_release = qq {SQL> DEFINE _SQLPLUS_RELEASE
DEFINE _SQLPLUS_RELEASE = "1202000100" (CHAR)
SQL> QUIT};
  1. Execute Perl script as:

    perl Makefile.PL -l

  2. Replace rows 569-581 (because Ubuntu under Windows does not support paths with colon) with the rows below:

    lib/DBD/Oracle.pm $(INST_MAN3DIR)/DBD_Oracle.$(MAN3EXT) \ lib/DBD/Oracle/GetInfo.pm $(INST_MAN3DIR)/DBD_Oracle_GetInfo.$(MAN3EXT) \ lib/DBD/Oracle/Object.pm $(INST_MAN3DIR)/DBD_Oracle_Object.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Aix.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Aix.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Cygwin.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Cygwin.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Hpux.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Hpux.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Linux.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Linux.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Macos.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Macos.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Sun.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Sun.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Vms.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Vms.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Win32.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Win32.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Win64.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Win64.$(MAN3EXT)

    1. Make with the command:

    make && make test

    1. Install with the command

    sudo make install

  1. 执行 Perl 脚本为:

    perl Makefile.PL -l

  2. 将第 569-581 行(因为 Windows 下的 Ubuntu 不支持带冒号的路径)替换为以下行:

    lib/DBD/Oracle.pm $(INST_MAN3DIR)/DBD_Oracle.$(MAN3EXT) \ lib/DBD/Oracle/GetInfo.pm $(INST_MAN3DIR)/DBD_Oracle_GetInfo.$(MAN3EXT) \ lib/DBD/Oracle/Object.pm $(INST_MAN3DIR)/DBD_Oracle_Object.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Aix.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Aix.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Cygwin.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Cygwin.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Hpux.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Hpux.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Linux.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Linux.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Macos.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Macos.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Sun.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Sun.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Vms.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Vms.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Win32.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Win32.$(MAN3EXT) \ lib/DBD/Oracle/Troubleshooting/Win64.pod $(INST_MAN3DIR)/DBD_Oracle_Troubleshooting_Win64.$(MAN3EXT)

    1. 用命令制作:

    make && make test

    1. 使用命令安装

    sudo make install

And hope that you've got all prerequisites installed before you begin.

并希望您在开始之前已安装所有先决条件。