How to Install SQLplus on Linux?
Oracle database is a popular database commonly used in transaction processing, data warehousing, and various other applications. SQLplus is an interface that Oracle itself develops. The main purpose of SQLplus is to interact with the Oracle DB and run various queries or code. We can say SQLplus is a powerful tool rather than an interface. It acts like an editor, and writer and also executes the SQL queries and displays the output. In this article, we will review the installation steps for SQLplus in the Linux operating system.
Installing SQLplus on Linux
Follow the below steps to install SQLPlus on a Linux Operating System:
Step 1: Download the Basic Package (ZIP) by using the following command:
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip

Step 2: Download the SQL*Plus Package (ZIP) by using the following command:
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip

Step 3: Make a new directory for the instant client.
sudo mkdir -p /opt/oracle

Step 4: Unzip the Basic Package in the newly-created directory.
sudo unzip -d /opt/oracle instantclient-basic-linux.x64-21.4.0.0.0dbru.zip

Step 5: Unzip the SQL *Plus Package in the newly-created directory.
sudo unzip -d /opt/oracle instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip

Step 6: List out the file contents of the newly-created directory.
cd /opt/oracle/instantclient_21_4 && find . -type f | sort

Step 7: Set the LD_LIBRARY_PATH in your ~/.bashrc source file.
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_4:$LD_LIBRARY_PATH

Step 8: Set the PATH env vars in your ~/.bashrc
export PATH=$LD_LIBRARY_PATH:$PATH

Step 9: Source your ~/.bashrc file
source ~/.bashrc

Step 10: Run sqlplus -V command to confirm it’s installed or not.
sqlplus -V

Step 11: Connect to the Database
- Use the following command to connect to the database:
sqlplus username/password@//hostname:port/service_name
- Example
sqlplus scott/tiger@//localhost:1521/orcl
Conclusion
Putting SQLPlus on Linux is an easy procedure that requires obtaining the Oracle Instant Client packages through download, configuring environment variables, and linking to your Oracle database. By adhering to the instructions provided in this manual, you can effectively handle your Oracle databases from the Linux command line with SQLPlus. Whether you're a developer, database administrator, or IT expert, learning SQL*Plus on Linux will improve your ability to manage databases and make your work more efficient.