Error while installing DBD::Oracle

12,884

Solution 1

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

  1. Download the tar.gz package and unpack it

  2. Build it

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

    make install
    

Solution 2

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 :

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::Oracle returns no error.

Solution 3

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

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

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.

Solution 4

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

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

Share:
12,884
Mandar Shinde
Author by

Mandar Shinde

Updated on July 26, 2022

Comments

  • Mandar Shinde
    Mandar Shinde almost 2 years

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

    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

    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 this guide.

  • sbnarra
    sbnarra about 9 years
    I have wasted half a day trying to find this. Thanks, it solved my problem. Though what does the -l flag actually do?
  • Glenn
    Glenn about 8 years
    same here!! everywhere I searched, people were being admonished to read the README file, but the file said VERY little about InstantClient! I'm in total shock that it came down to adding -l. Holy smokes. THANK YOU!
  • Glenn
    Glenn about 8 years
    One other detail: among my failed attempts to get the ding-dong thing to install, I did SOMETHING that caused two softlinks to be created: ## sudo ln -s libclntsh.so.11.1 libclntsh.so ## sudo ln -s libocci.so.11.1 libocci.so ## And yes, I verified that creating those links was not sufficient; the magic was in adding that '-l' as above.
  • tjd
    tjd almost 8 years
    @Arran Check out lines 132..134 or 192 of DBD::Oracle's Makefile.PL
  • partyd
    partyd about 6 years
    Did you do a full DB install or just the instant client? I cant find this demo/demo.mk file when installing just the instant client.
  • partyd
    partyd about 6 years
    Did you install instant client rpms or the entire oracle database? When I install with instant client I dont see the demo/demo.mk mentioned in the error.
  • Marcus
    Marcus about 6 years
    Thanks for this answer, it works. It's important that CPAN installers work because we do everything we can not to be running needed modules form the system Perl directories (using Carton).