Installing Oracle SQL Developer on Ubuntu
Oracle SQL Developer is a free, graphical tool for database development and management that supports Oracle Database and other relational databases. Below are step-by-step instructions to install and use it on Ubuntu:
1. System Requirements
Before starting, ensure your Ubuntu system meets these prerequisites:
- Ubuntu Version: 20.04 or higher (recommended for compatibility).
- Administrator Privileges: Required to install software and modify system files.
- Network Access: Stable internet connection to download the SQL Developer package and connect to databases.
- Java JDK: SQL Developer requires Java 8 (OpenJDK 8) or later (OpenJDK 11+ recommended). Verify with
java -version
; if not installed, proceed to the next step.
2. Install Java Development Kit (JDK)
SQL Developer is Java-based, so you must install a compatible JDK first. For most users, OpenJDK 11 is a safe choice:
sudo apt update sudo apt install openjdk-11-jdk
Verify the installation with:
java -version
You should see output confirming the OpenJDK version (e.g., "openjdk version “11.0.xx”).
3. Download Oracle SQL Developer
- Visit the Oracle SQL Developer Downloads page.
- Scroll down to the “Linux” section and download the latest no-JRE version (e.g.,
sqldeveloper-21.4.0.261.84-no-jre-unix.bin
). This version eliminates the need for a separate JRE installation. - Move the downloaded file to a directory of your choice (e.g.,
~/Downloads
).
4. Make the Installer Executable and Run It
- Open a terminal and navigate to the directory where the installer is saved:
cd ~/Downloads
- Grant execute permissions to the installer file:
chmod +x sqldeveloper-*.bin
- Run the installer:
sudo ./sqldeveloper-*.bin
- Follow the on-screen instructions:
- Accept the license agreement.
- Choose an installation directory (e.g.,
/opt/sqldeveloper
). - When prompted to install a JRE, select “Skip” (since you’ve already installed OpenJDK).
5. Configure Environment Variables
To run SQL Developer from any terminal, add its bin
directory to your PATH
:
- Open your shell configuration file (e.g.,
~/.bashrc
for Bash or ~/.zshrc
for Zsh):nano ~/.bashrc
- Add the following line at the end of the file (replace
/opt/sqldeveloper
with your installation directory):export PATH=$PATH:/opt/sqldeveloper/bin
- Save the file (
Ctrl+O
, Enter
, Ctrl+X
) and apply changes:source ~/.bashrc
Now you can launch SQL Developer from any terminal by typing sqldeveloper
.
6. Launch SQL Developer
Run the following command in your terminal:
sqldeveloper
The first launch will take a few moments to initialize. You’ll be prompted to enter the path to a JDK (if not detected automatically)—browse to your OpenJDK installation (e.g., /usr/lib/jvm/java-11-openjdk-amd64
).
Once initialized, the SQL Developer GUI will appear.
7. Connect to an Oracle Database
To manage a database, you need to create a connection:
- Click the New Connection icon (green “+” in the toolbar) or go to File > New > Connection.
- In the “New/Select Database Connection” window:
- Connection Name: Give the connection a meaningful name (e.g., “Local Oracle DB”).
- Username: Enter your database username (e.g.,
system
). - Password: Enter your password (check “Save Password” if desired).
- Connection Type: Select “Oracle (JDBC)”.
- Role: Choose “Default” (or “SYSDBA” if connecting as an administrator).
- Hostname: Enter the database server’s hostname (e.g.,
localhost
for local databases). - Port: Enter the listener port (default:
1521
). - SID/Service Name: Enter the database SID or service name (e.g.,
ORCLCDB
).
- Click Test to verify connectivity. If successful, you’ll see a “Status: Success” message.
- Click Save to store the connection, then click Connect to open the database session.
8. Troubleshooting Common Issues
- Java Errors: Ensure you’re using Java 8 or later and that
JAVA_HOME
is set correctly. Add export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
to ~/.bashrc
and run source ~/.bashrc
. - GUI Not Launching: Install required graphical libraries with
sudo apt install libxext6 libxrender1 libxtst6 libxi6 libfreetype6
. - Installation Issues: Run the installer with elevated privileges (
sudo
) and ensure you have enough disk space (at least 2GB recommended). - Connection Failures: Verify the database server is running, the hostname/port are correct, and your firewall allows traffic on port 1521.
By following these steps, you can successfully install and use Oracle SQL Developer on Ubuntu to manage Oracle Databases efficiently.