Priyanka U
Priyanka U

Reputation: 503

sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

Please suggest a solution for solving this issue?? While giving the command:

sqlplus /nolog

the error that occurred:

 sqlplus: error while loading shared libraries:
 libsqlplus.so: cannot open shared object file: No such file or directory

Upvotes: 39

Views: 209984

Answers (16)

marcello demuro
marcello demuro

Reputation: 1

In my case /Red Hat) I had to install libnsl :

yum install libnsl.x86_64

With the command "strace sqlplus /nolog" I found:

openat(AT_FDCWD, "/usr/lib/oracle/12.2/client64/lib/libnsl.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

And googling I found the solution.

Upvotes: 0

David KELLER
David KELLER

Reputation: 656

As mentioned on Oracle documentation, check the runtime link path ie. https://www.oracle.com/fr/database/technologies/instant-client/linux-x86-64-downloads.html

If Instant Client is the only Oracle Software installed on this system then update the runtime link path, for example:

sudo sh -c "echo /opt/oracle/instantclient_19_3 > \
      /etc/ld.so.conf.d/oracle-instantclient.conf" 
sudo ldconfig 

Using docker image nginx:stable


apt-get update -y
apt-get upgrade -y
apt-get install -y wget
apt-get install -y unzip
apt-get install -y libaio1

mkdir /opt/oracle
cd /opt/oracle

wget https://download.oracle.com/otn_software/linux/instantclient/219000/instantclient-basic-linux.x64-21.9.0.0.0dbru.zip
unzip instantclient-basic-linux.x64-21.9.0.0.0dbru.zip

wget https://download.oracle.com/otn_software/linux/instantclient/219000/instantclient-sqlplus-linux.x64-21.9.0.0.0dbru.zip
unzip instantclient-sqlplus-linux.x64-21.9.0.0.0dbru.zip

wget https://download.oracle.com/otn_software/linux/instantclient/219000/instantclient-sdk-linux.x64-21.9.0.0.0dbru.zip
unzip instantclient-sdk-linux.x64-21.9.0.0.0dbru.zip

sh -c "echo /opt/oracle/instantclient_21_9 > /etc/ld.so.conf.d/oracle-instantclient.conf"
ldconfig

export ORACLE_HOME=/opt/oracle/instantclient_21_9
export LD_LIBRAY_PATH=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME

sqlplus

Upvotes: 0

Vikas Sheoran
Vikas Sheoran

Reputation: 46

This worked for me: sudo dnf install libnsl

Upvotes: 2

hayden.mumm
hayden.mumm

Reputation: 121

On Ubuntu Server 20.04 and using instant client version 19.10.0.0, I used alien to install the rpm package. I got this error when I just used the -i option. However when, I added -c I did not have this issue. from the man page for alien:

-c, --scripts
Try to convert the scripts that are meant to be run when the package is installed and removed. Use this with caution, because these scripts might be designed to work on a system unlike your own, and could cause problems. It is recommended that you examine the scripts by hand and check to see what they do before using this option.

So it seems the correct configuration (in 19c) or the environment variables (in earlier versions) are set in these scripts which are not generated unless you run alien like this. (Thanks @Christopher Jones for correcting me on this)

sudo alien -i -c BasicPackage.rpm
sudo alien -i -c SqlPlus.rpm

Upvotes: 5

forzagreen
forzagreen

Reputation: 2693

You should already have all needed variables in /etc/profile.d/oracle.sh. Make sure you source it:

$ source /etc/profile.d/oracle.sh

The file's content looks like:

ORACLE_HOME=/usr/lib/oracle/11.2/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH

If you don't have it, create it and source it.

Upvotes: 9

totalamateurhour
totalamateurhour

Reputation: 376

@laryx-decidua: I think you are only seeing the 18.x instant client releases that are in the ol7_oci_included repo. The 19.x instant client RPMs, at the moment, are only in the ol7_oracle_instantclient repo. Easiest way to access that repo is:

yum install oracle-release-el7

Upvotes: 0

András Aszódi
András Aszódi

Reputation: 9690

On Oracle's own Linux (Version 7.7, PRETTY_NAME="Oracle Linux Server 7.7" in /etc/os-release), if you installed the 18.3 client libraries with

sudo yum install oracle-instantclient18.3-basic.x86_64
sudo yum install oracle-instantclient18.3-sqlplus.x86_64

then you need to put the following in your .bash_profile:

export ORACLE_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME

in order to be able to invoke the SQLPlus client, which, incidentally, is called sqlplus64 on this platform.

Upvotes: 2

Sylvain Leroux
Sylvain Leroux

Reputation: 52040

The minimum configuration to properly run sqlplus from the shell is to set ORACLE_HOME and LD_LIBRARY_PATH. For ease of use, you might want to set the PATH accordingly too.

Assuming you have unzipped the required archives in /opt/oracle/instantclient_11_1:

$ export ORACLE_HOME=/opt/oracle/instantclient_11_1
$ export LD_LIBRARY_PATH="$ORACLE_HOME"
$ export PATH="$ORACLE_HOME:$PATH"

$ sqlplus

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Dec 31 14:06:06 2014
...

Upvotes: 43

VonNaturAustreVe
VonNaturAustreVe

Reputation: 491

You can try usage:

# echo "/usr/lib/oracle/12.2/client64/lib" > /etc/ld.so.conf.d/oracle.conf
# ldconfig

This problem are because oracleinstant client not configure shared library.

Upvotes: 2

Toolkit
Toolkit

Reputation: 11119

sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf";sudo ldconfig

from https://help.ubuntu.com/community/Oracle%20Instant%20Client

Upvotes: 22

michal
michal

Reputation: 323

I know it's an old thread, but I got into this once again with Oracle 12c and LD_LIBRARY_PATH has been set correctly. I have used strace to see what exactly it was looking for and why it failed:

 strace sqlplus /nolog

sqlplus tries to load this lib from different dirs, some didn't exist in my install. Then it tried the one I already had on my LD_LIBRARY_PATH:

open("/oracle/product/12.1.0/db_1/lib/libsqlplus.so", O_RDONLY) = -1 EACCES (Permission denied)

So in my case the lib had 740 permissions, and since my user wasn't an owner or didn't have oracle group assigned I couldn't read it. So simple chmod +r helped.

Upvotes: 4

user6853110
user6853110

Reputation: 21

Don't forget

apt-get install libaio1 libaio-dev

or

yum install libaio

Upvotes: 1

gidi gob
gidi gob

Reputation: 61

PERMISSIONS: I want to stress the importance of permissions for "sqlplus".

  1. For any "Other" UNIX user other than the Owner/Group to be able to run sqlplus and access an ORACLE database , read/execute permissions are required (rx) for these 4 directories :

    $ORACLE_HOME/bin , $ORACLE_HOME/lib, $ORACLE_HOME/oracore, $ORACLE_HOME/sqlplus

  2. Environment. Set those properly:

    A. ORACLE_HOME (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/)

    B. LD_LIBRARY_PATH (example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib)

    C. ORACLE_SID

    D. PATH

     export PATH="$ORACLE_HOME/bin:$PATH"
    

Upvotes: 3

Leon Rom
Leon Rom

Reputation: 567

I did solve this error by setting

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME

yes, not only $ORACLE_HOME/lib but $ORACLE_HOME too.

Upvotes: 15

Charmi
Charmi

Reputation: 610

Could you please check if LD_LIBRARY_PATH points to the oracle libs

Upvotes: 1

doc123
doc123

Reputation: 106

It means you didn't set ORACLE_HOME and ORACLE_SID variables. Kindly set proper working $ORACLE_HOME and $ORACLE_SID and after that execute sqlplus /nolog command. It will be working.

Upvotes: 0

Related Questions