27

I am trying to acces oracle from linux server. I am using unixODBC.

When i try to acces oracle using isql and i get error that driver manager can't open libsqora.so.12.1.

odbc.ini

[NAME]
 Application Attributes = T
 Attributes = W
 BatchAutocommitMode = IfAllSuccessful
 BindAsFLOAT = F
 CloseCursor = F
 DisableDPM = F
 DisableMTS = T
 Driver = Oracle 11g ODBC driver
 DSN = DSN_NAME
 EXECSchemaOpt =
 EXECSyntax = T
 Failover = T
 FailoverDelay = 10
 FailoverRetryCount = 10
 FetchBufferSize = 64000
 ForceWCHAR = F
 Lobs = T
 Longs = T
 MaxLargeData = 0
 MetadataIdDefault = F
 QueryTimeout = T
 ResultSets = T
 ServerName = ServerName
 SQLGetData extensions = F
 Translation DLL =
 Translation Option = 0
 DisableRULEHint = T
 UserID = xxxx
 Password=<password>
 StatementCache=F
 CacheBufferSize=20
 UseOCIDescribeAny=F

odbcinst.ini

 [Oracle 11g ODBC driver]
 Description=Oracle ODBC driver for Oracle 11g
 Driver=/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so
 FileUsage=1

Then, when i use isql to acces oracle i get the following error:

 [root@xxxxx lib]# isql -v NAME
 [01000][unixODBC][Driver Manager]Can't open lib '/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so' : file not found
 [ISQL]ERROR: Could not SQLConnect

I had typo in odbcinst.ini. I have corrected but still same error.

 [root@xxxxx tmp]# isql -v NAME
 [01000][unixODBC][Driver Manager]Can't open lib '/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1' : file not found
 [ISQL]ERROR: Could not SQLConnect


 [root@xxxxx tmp]# ls -l /usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1
 -rw-r--r-- 1 bin bin 996363 Sep  5  2010 /usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1

 [Oracle 11g ODBC driver]
  Description=Oracle ODBC driver for Oracle 11g
  Driver=/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1
  FileUsage=1

ENV

 [root@xxxxx tmp]# env
 HOSTNAME=xxxxx
 SSH2_TTY=/dev/pts/0
 SHELL=/bin/bash
 TERM=xterm
 HISTSIZE=1000
 ODBC_DIR=/usr/local/easysoft/unixODBC
 OLDPWD=/usr/local/easysoft
 SSH_SESSION_ID=1424
 SSH_TTY=/dev/pts/0
 LD_LIBRARY_PATH=/usr/local/easysoft/lib:/usr/local/easysoft/unixODBC/lib
 A__z="*SHLVL
 TNS_ADMIN=/usr/local/easysoft/oracle/InstantClient112/network/
 INPUTRC=/etc/inputrc
 PWD=/tmp
 LANG=en_US.UTF-8
 ODBCSYSINI=/etc/
 HOME=/root
 SHLVL=3
 ODBCINI=/etc
 LESSOPEN=|/usr/bin/lesspipe.sh %s
 ORACLE_HOME=/usr/local/easysoft/oracle/InstantClient112/
 G_BROKEN_FILENAMES=1
 _=/bin/env

 PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/easysoft/unixODBC/bin:/opt/oraClient/11.2.0.4/bin

Fixed original issue with LD_LIBRARY_PATH updates but now it is broken again since I am trying to use the 32bit Oracle client.

Installed 32bit oracle client in directory /opt/oraClient/11.2.0.4_32/.

Modified the odbcinst.ini:

[Oracle 11g ODBC driver]
Description=Oracle ODBC driver for Oracle 11g
#Driver=/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1
Driver=/opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1
FileUsage=1

Error:

[root@xxxxx lib]# /usr/local/bin/isql -v NAME                                                      
 [01000][unixODBC]  [Driver Manager]Can't open lib '/opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1' : file not found
 [ISQL]ERROR: Could not SQLConnect

If I need to use the 32bit Oracle client, what am i doing wrong...I know it is something in environmental variables.

 [root@xxxxx lib]# file /opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1
 /opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

I enable trace but am not able to attach document here. I can email.

More debug info:

 [root@xxxxx bin]# ldd /opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1
 ldd: warning: you do not have execution permission for `/opt/oraClient/11.2.0.4_32/lib/libsqora.so.11.1'
    linux-gate.so.1 =>  (0xffffe000)
    libdl.so.2 => /lib/libdl.so.2 (0xf7f2b000)
    libm.so.6 => /lib/libm.so.6 (0xf7f02000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xf7ee8000)
    libnsl.so.1 => /lib/libnsl.so.1 (0xf7ecf000)
    libclntsh.so.11.1 => not found
    libodbcinst.so.1 => not found
    libc.so.6 => /lib/libc.so.6 (0xf7d71000)
    /lib/ld-linux.so.2 (0x00134000)

I don't get one the "not found" which may be causing some problems:

 [root@xxxxx bin]# ls /opt/oraClient/11.2.0.4_32/lib/libclntsh.so.11.1
 /opt/oraClient/11.2.0.4_32/lib/libclntsh.so.11.1

Below is the most recent env output:

 [root@xxxxx]# env
  HOSTNAME=xxxxx
  SSH2_TTY=/dev/pts/0
  TERM=xterm
  SHELL=/bin/bash
  HISTSIZE=1000
  ODBC_DIR=/usr/local/easysoft/unixODBC
  SSH_TTY=/dev/pts/0
        LD_LIBRARY_PATH=/opt/oraClient/11.2.0.4_32/:/opt/oraClient/11.2.0.4_32/lib/:/usr/local/easysoft/oracle/InstantClient112:/usr/local/easysoft/oracle/InstantClient112/lib/
  TNS_ADMIN=/opt/oraClient/11.2.0.4_32/network/
  PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/easysoft/unixODBC/bin:/opt/oraClient/11.2.0.4_32/bin
  INPUTRC=/etc/inputrc
  LANG=en_US.UTF-8
  ODBCSYSINI=/etc/
  SHLVL=4
  HOME=/root
  ODBCINI=/etc
  ORACLE_HOME=/opt/oraClient/11.2.0.4_32/
  G_BROKEN_FILENAMES=1
  _=/bin/env
Kyle Decot
  • 20,715
  • 39
  • 142
  • 263
user3521305
  • 391
  • 1
  • 4
  • 6
  • The base instant client doesn't have that file (or a `lib` directory). So is it really the instant client as the path suggests, or a full client (or server)? – Alex Poole Apr 10 '14 at 22:45
  • Fixed...still not working. – user3521305 Apr 11 '14 at 01:29
  • If you've rearranged the instant client files, I don't know if that might be confusing internals links - perhaps the error is abput another that one then can't find? You might also need to add the `lib` directory (and/or its parent) to `LD_LIBRARY_PATH`, does that make any difference? – Alex Poole Apr 11 '14 at 06:49
  • I updated the LD_LIBRARY_PATH with your feedback and it worked. – user3521305 Apr 11 '14 at 18:51
  • I got isql working but found out that the the application that i am building this for only supports 32bit oracle client. Therefore I installed 32bit oracle and have broken it again. I am getting the same error now when executing sql. – user3521305 Apr 11 '14 at 20:39

3 Answers3

49

This error is misleading:

The file that the error claimed was not present did exist.

I was able to chase down the actual missing file by executing:

# ldd /path/to/your/socalled/missing/file.so

This returned a series of files and one said:

libodbcinst.so.2 => not found

That is was the culprit for me. I then created the link that I needed and voila, the error went away.

ref: http://mailman.unixodbc.org/pipermail/unixodbc-support/2011-November/003018.html

MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
user3771500
  • 491
  • 4
  • 2
  • Thanks for the tip, had the same missing file problem when setting up Linux I Application access on Ubuntu. – gfroese Aug 26 '14 at 15:18
  • If the file is present but not in the library path, you can set `LD_LIBRARY_PATH` or add a file to `/etc/ld/conf.d` and rerun `ldconfig` – Gert van den Berg Jun 08 '18 at 11:25
  • 1
    @user3771500 Can you pls post which links you created, I'm missing these files: libicuuc.so.42 and libicudata.so.42 – Alen Sep 24 '18 at 19:01
  • # ldd saved me! – avn May 27 '19 at 17:02
  • I'd like to know how you "created the link" as well? On my side I have `libclntsh.so.12.1 => not found` and `libclntshcore.so.12.1 => not found` – Alexis.Rolland Feb 10 '20 at 13:44
3

Instant client doesn't have a lib directory. If you've downloaded the instantclient-odbc-linux package and unzipped that in the same location as the basic package then the libsqora.so.11.1 file will be durectly under /usr/local/easysoft/oracle/InstantClient112.

So your .ini should point to:

Driver=/usr/local/easysoft/oracle/InstantClient112/libsqora.so.11.1

Note the extension though; you might want to soft-link that to libsqora.so. If you've moved the .so files into a subdirectory after unzipping (?) then you'd need:

Driver=/usr/local/easysoft/oracle/InstantClient112/lib/libsqora.so.11.1

It looks like you've reoriganised the instant client files after unzipping, creating a lib directory. I'm not sure if that will directly cause you problems. But you also haven't set LD_LIBRARY_PATH, as the installation instructions suggest:

Installation Steps:

  1. Download the appropriate Instant Client packages for your platform. All installations REQUIRE the Basic package.

  2. Unzip the packages into a single directory such as "instantclient".

  3. Set the library loading path in your environment to the directory in Step 2 ("instantclient"). On many UNIX platforms, LD_LIBRARY_PATH is the appropriate environment variable. On Windows, PATH should be used.

  4. Start your application and enjoy.

Clearly step (4) isn't working for you yet, but I think that's because you haven't done step (3); and I think as you've split the files - which might itself cause an issue - you may need to include both .../InstantClient112 and .../InstantClient112/lib in the LD_LIBRARY_PATH variable. And make sure the modified value is exported. I'm not sure why you'd want to rearrange the files though.

Alex Poole
  • 183,384
  • 11
  • 179
  • 318
  • This is company pacakged build for unixODBC and looks like they included the oracle driver and instantclient. But i am pointing the driver to the 32bit oracle installation under /opt/oraClient/11.2.0.4_32/. – user3521305 Apr 11 '14 at 20:45
  • Please help...I have tried every alteration to the odbsinst.ini file. – user3521305 Apr 11 '14 at 21:04
  • @user3521305 - if you're now getting ORA-01017, that isn't a driver or environment problem. You're successfully contacting a database, but whether it's the right one depends on where your `SMARTS_SDI_NA` DSN is pointing. That is the wrong DB instance, or the username or password in your `odbc.ini` are wrong for that DSN. Remember those are case-sensitive in 11g. One of those three must be wrong, I think, most likely the password. Check you can connect with a different client. – Alex Poole Apr 11 '14 at 22:35
  • I pasted the wrong output...the ORA-01017 is for the working one with the 64bit oracle driver...I can get that to work. My problem is when i try to use the 32bit oracle driver. – user3521305 Apr 12 '14 at 08:51
  • OK, then that file definitely exists - you got the 32-bit ODBC package - and you set `LD_LIBRARY_PATH` to that new location? – Alex Poole Apr 12 '14 at 09:14
  • Yes. I installed the 32bit Oracle client and set the LD_LIBRARY_PATH. Detail of the contents are above. – user3521305 Apr 12 '14 at 15:09
  • @user3521305 - the `not found` still suggests `LD_LIBRARY_PATH` isn't set, or isn't exported. – Alex Poole Apr 12 '14 at 15:25
  • I pasted the latest env output above...As you can see I have set the LD_LIBRARY_PATH. I think it has something to do with something to do with a missing file pointer for 32bit odbc driver. – user3521305 Apr 12 '14 at 15:37
  • The only thing i can think of is to install the 32bit Oracle client and driver again from Oracle site. The one I am using right now is a packaged version from my company but it was tested by them so hard to believe it would be broken. – user3521305 Apr 12 '14 at 15:42
  • @user3521305 - it's set, but are you sure it's exported? That's the only think I can think of that would cause this behaviour. – Alex Poole Apr 12 '14 at 15:59
  • It wouldn't be in env output if it wasn't exported. Is there someone with more experience that could troubleshoot via debug? – user3521305 Apr 12 '14 at 16:02
  • @user3521305 - yes it would. It wouldn't be in the output of `export` if it wasn't exported. Having both Oracle versions in it is confusing but it'll use the first match so shouldn't matter here. The file exists where you expect, the only reason for `ldd` not to be able to see it is that variable not being set/exported properly, in my experience anyway. Good luck. – Alex Poole Apr 12 '14 at 16:43
  • Is someone esle from support going to pick this up or is there no more help coming? – user3521305 Apr 13 '14 at 00:35
-3

sudo apt-get install libaio1 libaio-dev

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Ale Paciotti
  • 185
  • 1
  • 6