Oracle SQLPlus is the official command line tool for Oracle Database. With this tool, we can perform many tasks to our Oracle Database. In this tutorial, I am going to show you how to install SQLPlus on Ubuntu 18.04 and Ubuntu 18.10. The installation is not straight forward and it needs some basic understanding of Linux command line. But, I will try to explain every steps.
Steps to Install Oracle SQLPlus on Ubuntu
Step 1. Download the required packages
In order to run SQLPlus, we need two different packages. Go to the Oracle official download site and then select the appropriate package. If you are running Oracle Database 18.3, you should choose the 18.3 version. In this example, I use the version 12.2 because I have Oracle Database version 12.2 running on my network.
You will need to download these two files. Please note that if you are running Oracle 18.3, or any other version, you need to download the correct/match version with your Oracle Database.
You will have files as follow (This is for version 12.2)
Step 2. Extract the files
After you download the zip files, extract them to a special directory, for example: /opt/oracle/. You can extract them to different folder as you like.
ubuntu@ubuntu:~/Downloads$ sudo mkdir /opt/oracle
>>> This command will move the zip files to /opt/oracle directory <<<
ubuntu@ubuntu:~/Downloads$ sudo mv instantclient-* /opt/oracle
>>> change directory to /opt/oracle >>>
ubuntu@ubuntu:~/Downloads$ cd /opt/oracle
>>> Extract the zip files >>>
ubuntu@ubuntu:/opt/oracle$ sudo unzip instantclient-basic-linux.x64-184.108.40.206.0.zip
ubuntu@ubuntu:/opt/oracle$ sudo unzip instantclient-sqlplus-linux.x64-220.127.116.11.0.zip
After unzipping those two files, you should have a new directory under /opt/oracle/ called instantclient_12_2
Step 3. Configure SQLPlus
Prior to version 18.3, we need to create symbolic links for some files.
ln -s libclntsh.so.12.1 libclntsh.so
ln -s libocci.so.12.1 libocci.so
sudo apt install libaio1
Set the LD_LIBRARY_PATH environment variable with this command:
Next, add the the instantclient directory to system PATH with this command
To make it permanent, edit your .profile file.
Add these two lines to the end of the file
And then execute
Step 4. Connect to the Oracle Database using SQLPlus
Now you can start using SQLPlus. Usually, I use the following syntax to connect to my Oracle Database
- dhani is the database username
- mypassword is the password
- 192.168.100.51 is the IP address of the Oracle database server
- 1521 is the default Oracle port
- mydb01 is my database
ubuntu@ubuntu:~$ sqlplus dhani/mypassword@//192.168.100.51:1521/mydb01
SQL*Plus: Release 18.104.22.168.0 Production on Thu Jan 10 15:03:33 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Last Successful login time: Thu Jan 10 2019 13:58:26 +00:00
Oracle Database 12c Enterprise Edition Release 22.214.171.124.0 - 64bit Production
Thank you for reading this article. I hope you enjoy it and cheers.