How to install SqlPlus?

First of all you need to download Instant Client Downloads. Install alien package so you can install rpm packages by typing following command in terminal.

sudo apt-get install alien

Once that is done, go to the folder where the rpm files are located and execute the following:

sudo alien -i oracle-instantclient*-basic*.rpm
sudo alien -i oracle-instantclient*-sqlplus*.rpm
sudo alien -i oracle-instantclient*-devel*.rpm

You need to install libaio.so. Type following command to do it:

sudo apt-get install libaio1

Create Oracle configuration file:

sudo sensible-editor /etc/ld.so.conf.d/oracle.conf

Put this line in that file:

/usr/lib/oracle/<your version>/client/lib/ 

Note - for 64-bit installations, the path will be:

/usr/lib/oracle/<your version>/client64/lib/ 

Update the configuration by running following command:

sudo ldconfig

Try to connect using:

sqlplus username/password@//dbhost:1521/SID

or:

sqlplus testuser/password

Note that if you installed the 64-bit version, the client is called sqlplus64.


The alien thing didn't work because of:

Error: cannot open Name index using db5 - Permission denied (13)

Fortunately, there is a more native solution:

Download the zip files from Oracle, you need

  • Basic Package (ZIP) (or Basic Light Package (ZIP))
  • SQL*Plus Package (ZIP)

The archives extract into the same root folder. Put that folder where you put program files (e.g. /usr/share or $HOME/bin).

Then create a script that runs the executable after setting the LD_LIBRARY_PATH variable, so that libraries are found:

#!/bin/bash
CLIENTDIR=/usr/share/instantclient_12_2 # <------- adjust this to the path you use
export LD_LIBRARY_PATH="$CLIENTDIR"
"$CLIENTDIR"/sqlplus "$@"

Call it sqlplus, make it executable (chmod 755 sqlplus) and put it into a directory on your PATH (e.g. /usr/bin/), so that bash finds it.

That's it, now you can run sqlplus like:

sqlplus user/password@host:port/service

If it gives you:

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

you need to install the missing library with sudo apt-get install libaio1


I think this link would help. It is pretty descriptive. Make sure you follow all the steps. Still if you have any problems, don't hesitate to comment.