4

I am getting this exception:

Can't load '/usr/perl/lib/site_perl/5.8/x86_64-linux/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.8.0: cannot open shared object file: 
No such file or directory at
/.../perl/lib/5.8/x86_64-linux/DynaLoader.pm line 169

If I do ls -ltr /.../perl/lib/site_perl/5.8/x86_64-linux/auto/DBD/Oracle/Oracle.so I see that the file is there. The process I am running also sets LD_LIBRARY_PATH before attempting to connect. A build and deploy on another machine doesn't produce the same error and runs fine. Running uname -sm gives Linux x86_64 on both machines. Is there something else that could cause this error?

3
  • 1
    Are the permissions of that file identical on both machines? Commented Sep 11, 2014 at 0:35
  • Yes, I also tried sudo chmod 777 Oracle.so just to make sure it wasn't the issue. Commented Sep 11, 2014 at 6:30
  • What is on line 169 of the DynaLoader.pm file? cat -n DynaLoader.pm | grep ^169 Commented Sep 11, 2014 at 6:41

2 Answers 2

4

Another solution:
Just pass your Oracle path variables before you run any scripts: Like for perl you can do add below in beginning of your script:

BEGIN {
   my $ORACLE_HOME     = "/usr/lib/oracle/11.2/client64";
   my $LD_LIBRARY_PATH = "$ORACLE_HOME/lib";
   if ($ENV{ORACLE_HOME} ne $ORACLE_HOME
   || $ENV{LD_LIBRARY_PATH} ne $LD_LIBRARY_PATH
   ) {
      $ENV{ORACLE_HOME}     = "/usr/lib/oracle/11.2/client64";
      $ENV{LD_LIBRARY_PATH} = "$ORACLE_HOME/lib";
      exec { $^X } $^X, $0, @ARGV;
   }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Really cool hack! Just wanted to add that - in my experience - setting ORACLE_HOME isn't even needed, it's enough to just set LD_LIBRARY_PATH to the path where all the Oracle libs reside.
2

It looks like DBD::Oracle's Oracle.so is trying to open libclntsh.so.8.0 and can't find it. So you need to find out if that version of the shared library is installed.

Perform the following command:

$ locate libclntsh.so

You should get a list of files beginning with libclntsh.so. If you are lucky , libclntsh.so.8.0 will be among the results, and then you'll need to make sure that the directory that it lives in is on you load path. For instance my server has:

 $ locate libclntsh.so
 /home/oracle/11.2/lib/libclntsh.so
 /home/oracle/11.2/lib/libclntsh.so.10.1
 /home/oracle/11.2/lib/libclntsh.so.11.1

If locate fails completely, you can build the database using updatedb or you can try using find:

 find / -name 'libclntsh.so*' -print 

Use a pager or redirect stderr to a file because you might end up dealing with a lot of error messages from find, which is okay, but using less will allow you to just refresh the screen to see find's output.

1 Comment

Updating here: This was the correct answer. There were 2 issues: 1) The oracle client did get installed correctly on the server. 2) The application was using an outdated jar. I updated the build and redeployed..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.