I re-configured my local Windows Subsystem for Linux (WSL2) development environment and installed a fresh Oracle Linux 9.5 image on my Windows 11 Pro Workstation. Then I installed Oracle SQLcl, as this is my favorite SQL tool to interact with Oracle databases. But the first login? It took me almost 10 seconds until I got the SQL> prompt! Let’s investigate.
My WSL2 Setup
The Operating System is Oracle Linux 9.5, and the virtual machine gets a maximum of 8GB of memory. I used the image downloaded directly from the Microsoft Store.
JDK17
sudo dnf install java-17-openjdk
SQLcl 25.4
Download the required files here: https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/ and transfer the file to the WSL2 environment. You can do this easily via Windows Explorer, where the virtual machine directories are accessible.
- Go to temp directory and extract the file
- Move to /opt (default directory for optional Linux software)
- Make executable
cd /tmp
unzip sqlcl-*.zip
sudo mv sqlcl /opt/
chmod +x /opt/sqlcl/bin/sql
Next, I added the environment variables to my .bash_profile.
cat >> ~/.bash_profile << 'EOF'
# --- SQLCL and TNS_ADMIN ---
export SQLCL_HOME=/opt/sqlcl
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.17.0.10-1.0.1.el9.x86_64
export PATH=$PATH:$JAVA_HOME/bin:$SQLCL_HOME/bin
export TNS_ADMIN=$HOME/network/admin
EOF
Test the SQL Command Line Tool
Yes, it works, and I can log in. But the login time was a horror - almost 10 seconds just to get the prompt! I verified this using the simple time command.
$ time sql /nolog </dev/null
SQLcl: Release 25.2 Production on Mon Jan 12 10:25:50 2026
Copyright (c) 1982, 2026, Oracle. All rights reserved.
SQL>
real 0m9.172s
user 0m3.379s
sys 0m0.445s
Analysis
I tried verifying localhost settings, checked for DNS resolution issues in /etc/resolv.conf, changed the random number generator source, and even ran some strace commands, but nothing worked. Finally, after a coffee break, I had an idea: I needed to check exactly which sql executable is being used in my WSL2 Oracle Linux 9.5 environment when I type the command.
$ which sql
/mnt/c/Workspace/oracle/sqlcl-latest/sqlcl/bin/sql
As you can see, WSL2 has mapped my local Windows SQLcl installation path - yes, I have one installed directly on my Windows workstation - into Oracle Linux 9. What an overhead!
Fix it
I found two ways to handle this:
1) Disable PATH append in WSL2 - my favourite solution
Since many other local paths are appended to the $PATH variable - just type echo $PATH to see the amazing list - I decided to disable this feature via the wsl.conf configuration file.
There are many other options to configure; you can find them here: https://learn.microsoft.com/en-us/windows/wsl/wsl-config - and appending the PATH is a default behavior in WSL2.
- Edit wsl.conf.
sudo vi /etc/wsl.conf
- Add this line and save the file.
[interop]
appendWindowsPath = false
Note: When changing wsl.conf, a restart of the virtual machine is required to apply the changes. Execute this command in Windows PowerShell as Administrator.
wsl --shutdown
2) Add this line in .bash_profile before setting the PATH variables
- Edit .bash_profile
sudo vi $HOME/.bash_profile
- Add this line
export PATH="/home/martinxberger/bin:/home/martinxberger/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/sqlcl/bin"
Verification
Verify SQLcl used
After restarting and logging back in, I first verified which sql executable was being used. The locally installed Linux version of SQLcl is now shown.
$ which sql
/opt/sqlcl/bin/sql
Login Test
The speed is back! :-) It now takes just 1.7 seconds.
$ time sql /nolog </dev/null
Picked up JAVA_TOOL_OPTIONS: -Djava.security.egd=file:/dev/./urandom
SQLcl: Release 25.4 Production on Mon Jan 12 10:51:29 2026
Copyright (c) 1982, 2026, Oracle. All rights reserved.
SQL>
real 0m1.724s
user 0m3.130s
sys 0m0.321s
Now, let’s see if there is more to tune. 1.7 seconds is nice, but I know it can run faster. I want to find out more :-)