http://www.perlmonks.org?node_id=1218819

gandolf989 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to install DBD:Oracle and DBD so that I can write a script to clean up some attachments with our primary database, and change the pointers to show that the attachments are gone. But I ran into an issue with the above packages. I tried the initial install using cpan. but I did not have the environment variables set, so it did not compile correctly. I would like to remove and reinstall the packages, or mostly just get them working. I do have an 11.2.0.4 Oracle client on the server. But I will be connecting to another server for the database.

Can someone point me in the right direction. The server is Redhat 6.8. Thanks

$:~/ ./runMyPerlScript.pl Can't load '/usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/auto/DB +I/DBI.so' for module DBI: /usr/local/lib/perl5/site_perl/5.28.0/x86_6 +4-linux/auto/DBI/DBI.so: undefined symbol: PL_sv_immortals at /usr/li +b64/perl5/DynaLoader.pm line 200. at /usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/DBI.pm line 284 +. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBI.pm line 284. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.28.0 +/x86_64-linux/DBD/Oracle.pm line 20. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBD/Oracle.pm line 20. Compilation failed in require at /home/oracle/scripts/purge_proddoc_sc +ript/purge_proddoc_script.pl line 16. BEGIN failed--compilation aborted at /home/oracle/scripts/purge_proddo +c_script/purge_proddoc_script.pl line 16 (#1) (F) The module you tried to load failed to load a dynamic extensio +n. This may either mean that you upgraded your version of perl to one that + is incompatible with your old dynamic extensions (which is known to h +appen between major versions of perl), or (more likely) that your dynami +c extension was built against an older version of the library that i +s installed on your system. You may need to rebuild your old dynamic extensions. Uncaught exception from user code: Can't load '/usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux +/auto/DBI/DBI.so' for module DBI: /usr/local/lib/perl5/site_perl/5.28 +.0/x86_64-linux/auto/DBI/DBI.so: undefined symbol: PL_sv_immortals at + /usr/lib64/perl5/DynaLoader.pm line 200. at /usr/local/lib/perl5/site_perl/5.28.0/x86_64-linux/DBI.pm line 284 +. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBI.pm line 284. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.28.0 +/x86_64-linux/DBD/Oracle.pm line 20. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +28.0/x86_64-linux/DBD/Oracle.pm line 20. Compilation failed in require at /home/oracle/scripts/purge_proddoc_sc +ript/purge_proddoc_script.pl line 16. BEGIN failed--compilation aborted at /home/oracle/scripts/purge_proddo +c_script/purge_proddoc_script.pl line 16. at /home/oracle/scripts/purge_proddoc_script/purge_proddoc_script.pl +line 16. $:~/scripts/purge_proddoc_script > cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.8 (Santiago)
#!/usr/bin/perl use strict; use warnings; use diagnostics; package purge_proddoc_script; use Getopt::Std; # use Sys::Hostname; use POSIX qw(setuid setgid); use English; use Carp; use Cwd 'abs_path'; use DBD::Oracle qw(:ora_session_modes); use DBI; use File::Basename; use IO::Handle; use Log::Log4perl qw( :easy ); use Text::Diff; local $SIG{__WARN__} = \&Carp::cluck; $SIG{__DIE__} = sub { # return if $^S; # ignore die in an eval block # Get the actual caller for the "die" and not the wrapper local $Log::Log4perl::caller_depth; $Log::Log4perl::caller_depth++; LOGDIE($_[0]); }; # possible log values: DEBUG, INFO, WARN, ERROR, FATAL my $debug_level="INFO"; # my $error_mail_list='bbyrd@aires.com, ASayed@aires.com, vkamins@aire +s.com, RKatru@aires.com'; my $error_mail_list='bbyrd@aires.com'; # Unbuffer STDOUT and STDERR select STDERR; $| = 1; select STDOUT; $| = 1;

Replies are listed 'Best First'.
Re: I need help installing DBD:Oracle and DBD
by gandolf989 (Scribe) on Jul 19, 2018 at 14:04 UTC

    One issue I just noticed is that there are two versions of perl. I'm not sure if this is a problem.

    root@corpprdvl214:~ > /usr/local/bin/perl --version This is perl 5, version 28, subversion 0 (v5.28.0) built for x86_64-li +nux Copyright 1987-2018, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. root@corpprdvl214:~ > /usr/bin/perl --version This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.

      Citing the error message and its diagnostics again:

      This may either mean that you upgraded your version of perl to one that is incompatible with your old dynamic extensions (which is known to happen between major versions of perl), or (more likely) that your dynamic extension was built against an older version of the library that is installed on your system. You may need to rebuild your old dynamic extensions.

      So, you will need to make sure that your script(s) always invoke the perl 5.28 (under /usr/local/bin/perl), or recompile the Oracle DBD using your system Perl.

      Personally, I recommend leaving the vendor Perl well alone as it belongs to the vendor and changes to it should only be made through the vendor or tools that the vendor has supplied. So the approach favoured by me would be to make certain that all scripts only use /usr/local/bin/perl and all paths only pick up Perl libraries below /usr/local/lib/perl5/site_perl/5.28.0 (and the other version-specific directories).

        Corion, Thanks for pointing me in the right direction. I created a wrapper shell script to make sure that the environment variables were set before running the Perl script. I was able to get my usage code working. I just need to add the logic to clean up the old files.

        Thanks!