Perl DBD::Oracle Module installation

后端 未结 4 486
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 02:30

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

Here is what I have done so far:

  • Platform: RHEL 5.8 64 bit
  • I
相关标签:
4条回答
  • 2020-11-30 03:01

    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. The purpose is to reduce headache and turn it into a repeatable process.

    0 讨论(0)
  • 2020-11-30 03:12

    A little addition to slayedbylucifer answer. I had the same problem like mentioned in the question. I've done all the steps described by 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. The execution of the make command was without any errors.

    The only problem I still have is that I don't understand why this symbolic link is necessary.

    0 讨论(0)
  • 2020-11-30 03:13
    • 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
      

    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 users will need:

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

      Also add ORACLE_HOME to your PATH variable.

    • download DBD::Oracle from CPAN

    • 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.

    DONE !!!

    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.

    0 讨论(0)
  • 2020-11-30 03:15

    Here's what I did on CentOS 7.2 using yum packages and CPAN. This assumes you're using Oracle version 12.1 but I would imagine most versions will work this way.

    Install Oracle Instant Client

    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.

    sudo cp /usr/share/oracle/12.1/client64/demo/* /usr/share/oracle/12.1/client64
    

    Modify .bashrc

    Add the following lines to your ~/.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

    Update CPAN and DBI to the latest

    cpan> install CPAN
    cpan> reload cpan
    cpan> install DBI
    

    Install DBD::Oracle

    cpan> install DBD::Oracle
    
    0 讨论(0)
提交回复
热议问题