Much to my dismay, you are completely right
The problem is, I don't have an Oracle client installed in the machine. It is a server that has to communicate with a Data Base in a remote machine
The script was supposed to be ran in the server precisely to perform a simple query to a remote database and check that the connectivity is OK
I ran a:
$ ldd /soft/perl-5.10.1/bin/perl verify_database_connection.pl
To check which libraries and modules the script needs to load and where it is trying to look for them, and got:
open("/soft/ora1120/db/lib/tls/x86_64/libclntsh.so.11.1", O_RDONLY) =
+-1 ENOENT (No such file or directory)
stat("/soft/ora1120/db/lib/tls/x86_64", 0x7fff4406c740) = -1 ENOENT (N
+o such file or directory)
open("/soft/ora1120/db/lib/tls/libclntsh.so.11.1", O_RDONLY) = -1 ENOE
+NT (No such file or directory)
stat("/soft/ora1120/db/lib/tls", 0x7fff4406c740) = -1 ENOENT (No such
+file or directory)
open("/soft/ora1120/db/lib/x86_64/libclntsh.so.11.1", O_RDONLY) = -1 E
+NOENT (No such file or directory)
stat("/soft/ora1120/db/lib/x86_64", 0x7fff4406c740) = -1 ENOENT (No su
+ch file or directory)
open("/soft/ora1120/db/lib/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (
+No such file or directory)
stat("/soft/ora1120/db/lib", 0x7fff4406c740) = -1 ENOENT (No such file
+ or directory)
open("/etc/ld.so.cache", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=53762, ...}) = 0
mmap(NULL, 53762, PROT_READ, MAP_PRIVATE, 5, 0) = 0x7f012034a000
close(5) = 0
open("/lib64/tls/x86_64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No
+such file or directory)
stat("/lib64/tls/x86_64", 0x7fff4406c740) = -1 ENOENT (No such file or
+ directory)
open("/lib64/tls/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No such fi
+le or directory)
stat("/lib64/tls", 0x7fff4406c740) = -1 ENOENT (No such file or d
+irectory)
open("/lib64/x86_64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No such
+ file or directory)
stat("/lib64/x86_64", 0x7fff4406c740) = -1 ENOENT (No such file or d
+irectory)
open("/lib64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No such file o
+r directory)
stat("/lib64", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("/usr/lib64/tls/x86_64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT
+(No such file or directory)
stat("/usr/lib64/tls/x86_64", 0x7fff4406c740) = -1 ENOENT (No such fil
+e or directory)
open("/usr/lib64/tls/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No suc
+h file or directory)
stat("/usr/lib64/tls", 0x7fff4406c740) = -1 ENOENT (No such file or d
+irectory)
open("/usr/lib64/x86_64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No
+such file or directory)
stat("/usr/lib64/x86_64", 0x7fff4406c740) = -1 ENOENT (No such file or
+ directory)
open("/usr/lib64/libclntsh.so.11.1", O_RDONLY) = -1 ENOENT (No such fi
+le or directory)
The machine where the connection to the Oracle database works does have the libclntsh.so.11.1 module in
$ ls -ltr /soft/ora1020/lib | grep libclntsh.so.11.1
lrwxrwxrwx 1 root sys 17 Aug 20 2012 libclntsh.so.11.1 -> libclntsh.so.10.1
Then I copied the module from the remote machine to a local folder in my machine and edited the start as:
MYORACLELIBS=/pathtothefolder ; export MYORACLELIBS
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MYORACLELIBS} ; export LD_LIBRARY_P
+ATH
I still located one more Oracle module it needed to compile
Unluckily, once it compiled, it failed, because it needs an Oracle client installed. My code:
use strict;
use warnings;
use DBD::Oracle;
use DBI;
my $dbh = DBI->connect("dbi:Oracle://$host:1522:$db",$dbUser, $dbPass)
+ or die;
It died with the error
DBI connect('//yval1bk0:1522:RUM','DYNATRACE',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at /users/rum00/exploit/script/rum_verify_database_connection.pl line 44
I am not going to request the extra installation of an oracle client in a server that does not host any database
So I'll continue with my research but I'm afraid I will have to use the existing .jar to do this verification, instead of my adored Perl :)
|