DBD :: Oracle安装导致错误

时间:2014-02-28 06:04:00

标签: linux oracle perl module cpan

我想通过Perl连接到Oracle数据库。为此,我尝试使用以下命令从CPAN安装DBD :: Oracle:

[root@localhost Admin]# cpan DBD::Oracle

在我的Linux终端上运行命令时,我收到以下错误:

[root@localhost Admin]# cpan DBD::Oracle
CPAN: Storable loaded ok (v2.45)
Going to read '/root/.cpan/Metadata'
  Database was generated on Thu, 27 Feb 2014 06:17:02 GMT
Running install for module 'DBD::Oracle'
CPAN: YAML loaded ok (v0.88)
Running make for P/PY/PYTHIAN/DBD-Oracle-1.70.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
CPAN: Compress::Zlib loaded ok (v2.063)
Checksum for /root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.70.tar.gz ok
DBD-Oracle-1.70/
DBD-Oracle-1.70/lib/
DBD-Oracle-1.70/lib/DBD/
DBD-Oracle-1.70/lib/DBD/Oracle.pm
DBD-Oracle-1.70/lib/DBD/Oracle/
DBD-Oracle-1.70/lib/DBD/Oracle/GetInfo.pm
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Win32.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Vms.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Hpux.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Aix.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Sun.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Macos.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Linux.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Cygwin.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting/Win64.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Troubleshooting.pod
DBD-Oracle-1.70/lib/DBD/Oracle/Object.pm
DBD-Oracle-1.70/oci.def
DBD-Oracle-1.70/Makefile.PL
DBD-Oracle-1.70/MANIFEST
DBD-Oracle-1.70/ocitrace.h
DBD-Oracle-1.70/Changes
DBD-Oracle-1.70/LICENSE
DBD-Oracle-1.70/README.help.txt
DBD-Oracle-1.70/README.mkdn
DBD-Oracle-1.70/INSTALL
DBD-Oracle-1.70/Oracle.xs
DBD-Oracle-1.70/CONTRIBUTORS
DBD-Oracle-1.70/META.json
DBD-Oracle-1.70/oci8.c
DBD-Oracle-1.70/META.yml
DBD-Oracle-1.70/Oracle.h
DBD-Oracle-1.70/dbivport.h
DBD-Oracle-1.70/typemap
DBD-Oracle-1.70/t/
DBD-Oracle-1.70/t/23wide_db_al32utf8.t
DBD-Oracle-1.70/t/00versions.t
DBD-Oracle-1.70/t/22nchar_al32utf8.t
DBD-Oracle-1.70/t/31lob.t
DBD-Oracle-1.70/t/lib/
DBD-Oracle-1.70/t/lib/ExecuteArray.pm
DBD-Oracle-1.70/t/10general.t
DBD-Oracle-1.70/t/28array_bind.t
DBD-Oracle-1.70/t/26exe_array.t
DBD-Oracle-1.70/t/14threads.t
DBD-Oracle-1.70/t/rt74753-utf8-encoded.t
DBD-Oracle-1.70/t/23wide_db.t
DBD-Oracle-1.70/t/22nchar_utf8.t
DBD-Oracle-1.70/t/31lob_extended.t
DBD-Oracle-1.70/t/000-report-versions-tiny.t
DBD-Oracle-1.70/t/12impdata.t
DBD-Oracle-1.70/t/36lob_leak.t
DBD-Oracle-1.70/t/24implicit_utf8.t
DBD-Oracle-1.70/t/38taf.t
DBD-Oracle-1.70/t/21nchar.t
DBD-Oracle-1.70/t/70meta.t
DBD-Oracle-1.70/t/15nls.t
DBD-Oracle-1.70/t/39attr.t
DBD-Oracle-1.70/t/rt85886.t
DBD-Oracle-1.70/t/34pres_lobs.t
DBD-Oracle-1.70/t/56embbeded.t
DBD-Oracle-1.70/t/40ph_type.t
DBD-Oracle-1.70/t/55nested.t
DBD-Oracle-1.70/t/30long.t
DBD-Oracle-1.70/t/32xmltype.t
DBD-Oracle-1.70/t/58object.t
DBD-Oracle-1.70/t/50cursor.t
DBD-Oracle-1.70/t/80ora_charset.t
DBD-Oracle-1.70/t/51scroll.t
DBD-Oracle-1.70/t/01base.t
DBD-Oracle-1.70/t/20select.t
DBD-Oracle-1.70/t/nchar_test_lib.pl
DBD-Oracle-1.70/t/23wide_db_8bit.t
DBD-Oracle-1.70/t/60reauth.t
DBD-Oracle-1.70/t/rt13865.t
DBD-Oracle-1.70/t/25plsql.t
DBD-Oracle-1.70/examples/
DBD-Oracle-1.70/examples/japh
DBD-Oracle-1.70/examples/oradump.pl
DBD-Oracle-1.70/examples/ora_explain.pl
DBD-Oracle-1.70/examples/commit.pl
DBD-Oracle-1.70/examples/bind.pl
DBD-Oracle-1.70/examples/curref.pl
DBD-Oracle-1.70/examples/ex.pl
DBD-Oracle-1.70/examples/read_long_via_blob_read.pl
DBD-Oracle-1.70/examples/tabinfo.pl
DBD-Oracle-1.70/examples/proc.pl
DBD-Oracle-1.70/examples/sql
DBD-Oracle-1.70/examples/mktable.pl
DBD-Oracle-1.70/examples/inserting_longs.pl
DBD-Oracle-1.70/examples/README
DBD-Oracle-1.70/mkta.pl
DBD-Oracle-1.70/Todo
DBD-Oracle-1.70/dbdimp.h
DBD-Oracle-1.70/hints/
DBD-Oracle-1.70/hints/macos_syms.pl
DBD-Oracle-1.70/hints/macos_bundle.syms
DBD-Oracle-1.70/hints/macos_lib.syms
DBD-Oracle-1.70/hints/dgux.pl
DBD-Oracle-1.70/hints/svr4.pl
DBD-Oracle-1.70/dbdimp.c
DBD-Oracle-1.70/README
CPAN: File::Temp loaded ok (v0.22)

  CPAN.pm: Going to build P/PY/PYTHIAN/DBD-Oracle-1.70.tar.gz

Using DBI 1.609 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/auto/DBI/

Configuring DBD::Oracle for perl 5.010001 on linux (x86_64-linux-thread-multi)

Remember to actually *READ* the README file! Especially if you have any problems.

Trying to find an ORACLE_HOME
Your LD_LIBRARY_PATH env var is set to ''

      The ORACLE_HOME environment variable is not set and I couldn't guess it.
      It must be set to hold the path to an Oracle installation directory
      on this machine (or a machine with a compatible architecture).
      See the appropriate README file for your OS for more information.
      ABORTED!

Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
  PYTHIAN/DBD-Oracle-1.70.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
[root@localhost Admin]#

目前我正在使用LINUX CentOS。在我的机器上,我已经使用SQLDeveloper连接到Oracle数据库,但我不知道是否设置了ORACLE_HOME,因为我没有安装它。

之前有没有人遇到过同样的问题?请告诉我如何解决此错误。

3 个答案:

答案 0 :(得分:1)

按给定的顺序参考这些步骤。

我使用的是64位linux盒子,因此请相应选择你的RPM。

  • 设置以下变量:

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

    MacOS用户需要:

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

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

  • CPAN下载 DBD :: Oracle

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

    perl Makefile.PL
    make
    make install
    

    或者您可以使用cpan命令

  • 安装模块

完成!!!

答案 1 :(得分:0)

感谢您的信息!我注意到oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm安装到/ usr中。所以添加这样的软链接有助于我解决问题。

sudo ln -s /usr/include/oracle/11.2/client64 $ ORACLE_HOME / include

答案 2 :(得分:0)

在安装 DBD:Oracle 之前不要忘记安装 gcc。这也是一个先决条件