Niru Niru - 3 months ago 17
Perl Question

Can't load oracle.so

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?

Answer

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.