If you are running a Linux version that does not support RPM packages and you need to install Oracle's sqlplus client, you have two options to install it:
- If you have a DEBIAN-based Linux distro, download the RPM package and convert it to a DEB package using the alien utility. This can get a little complicated and requires you to unpack the .rpm file and then rebuild the pack of files into a .deb file. And then install it using your preferred DEB package installer.
- Download one of the .zip files from Oracle. Which ones, you ask? It is not obvious which ones to download and if you don't get the correct combination of files, you get errors such as
sqlplus: error while loading shared libraries: libclntsh.so.21.1: cannot open shared object file: No such file or directory
when you try to run sqlplus. Here is the installation recipe for a full-fat installation of SQLPLUS: - Go to https://www.oracle.com/uk/database/technologies/instant-client/linux-x86-64-downloads.html
- Decide which version you need. The latest is always more interesting. Here we use version 21.11.
- Download the "Base" package:
instantclient-basic-linux.x64-21.11.0.0.0dbru.zip
- Download the "SQLPLUS" package:
instantclient-sqlplus-linux.x64-21.11.0.0.0dbru.zip
- Download the "Tools" package:
instantclient-tools-linux.x64-21.11.0.0.0dbru.zip
- Download the "Development and Runtime" package:
instantclient-sdk-linux.x64-21.11.0.0.0dbru.zip
- Download the "ODBC" package:
instantclient-odbc-linux.x64-21.11.0.0.0dbru.zip
- Unzip them all :
$ unzip instantclient-sqlplus-linux.x64-21.11.0.0.0dbru.zip && unzip instantclient-sdk-linux.x64-21.11.0.0.0dbru.zip && unzip instantclient-odbc-linux.x64-21.11.0.0.0dbru.zip && unzip instantclient-basic-linux.x64-21.11.0.0.0dbru.zip && unzip instantclient-tools-linux.x64-21.11.0.0.0dbru.zip
A directory called instantclient_21_11
will be created.
You can get away by only downloading the "Base" package if all you want is a minimal installation and then unzipping it. Follow on from here.
- Move this to
/opt/oracle
:
sudo mkdir -p /opt/oracle/
sudo mv instantclient_21_11 /opt/oracle/
.
- Create a sym-link:
cd /opt/oracle/
sudo ln -s instantclient_21_11 instantclient
- Set the environment variables up in your ~/.bashrc file
export LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH
export PATH=/opt/oracle/instantclient:$PATH
- In a new terminal, test it like this:
$ sqlplus -V
SQL*Plus: Release 21.0.0.0.0 - Production
Version 21.11.0.0.0