Search notes:

Oracle: Install Instant Client in Linux

The following shell commands try to demonstrate how parts of Oracle's instant client can be installed on Linux. It installs the Basic Light package (only English error messages and US and European character set), SQL*Plus and tools (Data Pump, SQL*Loader and Workload Replay Client). Noteably, tnsping is not part of the instant client.
DESTDIR=~/bin

if [ ! -e client.zip ]; then
   wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -O client.zip
fi

if [ ! -e sqlplus.zip ]; then
   wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip   -O sqlplus.zip
fi

if [ ! -e tools.zip ]; then
   wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-tools-linuxx64.zip     -O tools.zip
fi

if [ ! -e $DESTDIR ]; then
   mkdir -p $DESTDIR
fi

unzip -o -d $DESTDIR client.zip
unzip -o -d $DESTDIR sqlplus.zip
unzip -o -d $DESTDIR tools.zip

rm client.zip
rm sqlplus.zip
rm tools.zip

Setting PATH and LD_LIBRARY_PATH to execute binaries

LD_LIBRARY_PATH must be set to the directory into which the files were extracted:
export LD_LIBRARY_PATH=$DESTDIR/instantclient_21_13:$LD_LIBRARY_PATH
Alternatively, the library path can be more permanently be configured like so:
sudo sh -c "echo $DESTDIR/instantclient_21_13 > /etc/ld.so.conf.d/oracle-instantclient.conf"
sudo ldconfig
Then, the binaries can be executed:
$DESTDIR/instantclient_21_13/sqlplus …
Adding the directory to PATH as well allows to execute the binaries without having to type the full path to the executable:
PATH=$PATH:$DESTDIR/instantclient_21_10:$LD_LIBRARY_PATH
Alternatively, symbolic links can be created from a directory that is pointed at by the $PATH variable to the executables of the instant client.
find $DESTDIR/instantclient_21_13 -type f -executable -exec ln -s {} ~/bin \;

Copying files

Even another alternative to modifying PATH and LD_LIBRARY_PATH is to copy shared objects (i. e. executables which match the regular expression .so(\.\d)?) to /usr/lib and other executables to /usr/bin.
This can be achieved with the following find command:
sudo find $DESTDIR -executable -type f  \
  \(     -regex '.*\.so\(\.\d\)?.*' -exec cp -i {} /usr/lib \;   -o \
                                    -exec cp -i {} /usr/bin \; \)

Missing libaio.so.1

It's possible that libaio must be installed:
$ sqlplus rene/rene@ora23
sqlplus: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
In this case, it needs to be installed as well
$ sudo apt install -y libaio1

Links

Find the newest zip files in the download page.

Index