Error while installing DBD::Oracle
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
Download the
tar.gz
package and unpack itBuild it
perl Makefile.PL -l
make && make testInstall
make install
Perl DBD::Oracle Module installation
- 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/client64MacOS users will need:
DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/
Also add
ORACLE_HOME
to yourPATH
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.
Regarding Perl DBD::Oracle installation in local directory
If DBI is already installed, you should only need to install DBD::Oracle, though you might want to install a later version of DBI. You can install DBD::Oracle under your home directory, then set the PERL5LIB environment variable to that directory (or to include that directory). The long way to install is:
perl Makefile.PL PREFIX=~/perl #Or whatever sub-directory you like
make
make test
make install
Then include at least "~/perl/lib;~/perl/lib/site_perl" in PERL5LIB before running your programs (or include a 'use lib" in your programs).
You can also set certain environment variables like PERL_MM_OPT and PERL_MB_OPT so that you don't have to specify the PREFIX= on the command line (see docs for ExtUtils::MakeMaker and Module::Build). I also recommend cpanm and setting PERL_CPANM_HOME to something under your home directory.
DBD::Oracle fails to connect with OCIEnvInit when called when accessed through webserver only
Are you sure that ORACLE_HOME
and other relevant environment variables (e.g., LD_LIBRARY_PATH
) that are set in your shell when you run the script from the command line are also set to the same values in the apache/PHP process?
DBD::Oracle: load_file:The specified module could not be found
Apparently, a reboot was needed. After the reboot, connections through Perl were possible. This is here in case someone is as stupid as me. I'm going back my AS/400 now...
Related Topics
Ansible Inside Script Command Not Found
How to Install Packages in Linux (Centos) Without Root User with Automatic Dependency Handling
How to Use Nohup to Run Process as a Background Process in Linux
Keep Remote Directory Up-To-Date
How to Monitor Data on a Serial Port in Linux
Id_Rsa.Pub File Ssh Error: Invalid Format
Gcc Verbose Mode Output Explanation
Linux Directory Permissions for Different Groups
Running Apt-Get for Another Partition/Directory
Count the Number of Executable Files in Bash
Calculate Size of Files in Shell
Internals of a Linux System Call
How to Install Chkconfig on Ubuntu
Linux Distribution Binary Compatibility
Check If Environment Variable Is Already Set
Linux Command to Check New Files in File System
Ps Utility in Linux (Procps), How to Check Which CPU Is Used