Search This Blog

Wednesday, November 12, 2025

Setting up Oracle Sqlplus on Windows, WSL Linux, and Mac OS

 


I was working through Oracle and PL-SQL training and was interested in seeing if I could set my work environment to allow work in WSL Bash on my Windows 11 workstation.

After downloading and setting up Oracle DB for Windows 11, and connecting via with SQL Developer and sqlplus and, I then turned my attention to WSL and my Mac.   : )


In Windows 11:


Windows Oracle SQL Developer connects by...
             hostname:localhost, port:1521, Service name: FREEPDB1   <<-- works!

DOS:    sqlplus system@//localhost:1521/FREEPDB1 works!   <<-- works!



Local Windows 11 prep...

You can get the instant client from Oracle (shown below), and installed, but it wont work without some modification to the local DB configuration and firewall, so do them first.

Oracle Configuration ...

The local Windows Oracle db configuration required a modification to D:\Oracle\dbhomeFree\network\admin\listener.ora. Mine looked similar to:

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = Toy4)(PORT = 1521))

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )


*Toy4 is the current host.


Firewall configuration...

I also had to fix the windows host firewall with a new inbound rule like this:

## set up open 1521 port

d:/> wf.msc

name Oracle DB Inbound

TCP

PORT 1521

PUBLIC, PRIVATE


WSL BASH client...

Get the instant client software from Oracle for WSL Bash.

https://www.oracle.com/database/technologies/instant-client/downloads.html


Instant Client for Linux x86-64

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

d:\downloads\instantclient-basic-linux.x64-23.26.0.0.0.zip

SQL*Plus Package (ZIP)

d:\downloads\instantclient-sqlplus-linux.x64-23.26.0.0.0.zip


BASH Setup

I put all my WSL bash stuff in d:\oracle\WslBash 

$ cd /mnt/d/Oracle

$ mkdir WslBash

$ cd WslBash

$ unzip /mnt/d/downloads/instantclient-basic-linux.x64-*.zip

$ unzip /mnt/d/downloads/instantclient-sqlplus-linux.x64-*.zip

$ export ORACLE_HOME=/mnt/d/oracle/WslBash/instantclient_23_26

$ export LD_LIBRARY_PATH=$ORACLE_HOME

$ export PATH=$ORACLE_HOME:$PATH

    #to make it persistent add it to the .bashrc file


Test

sqlplus system@//Toy4:1521/FREEPDB1   <<-- Works!    : )


Mac OS on ARM (Zsh shell)


You can get the software needed from

https://www.oracle.com/database/technologies/instant-client/macos-arm64-downloads.html


Downloaded

Basic Package (DMG)

            instantclient-basic-macos.arm64-23.3.0.23.09-2.dmg

SQL*Plus Package (DMG)

            instantclient-sqlplus-macos.arm64-23.3.0.23.09.dmg


Install the software using Terminal & Finder...

Docs: https://www.oracle.com/database/technologies/instant-client/macos-arm64-downloads.html#install-ic


Install the Basic tools

% cd ~/Downloads

% hdiutil mount instantclient-basiclite-macos.arm64-23.3.0.23.09.dmg

#  This mounts as "-02": instantclient-basiclite-macos.arm64-23.3.0.23.09-02

% cd /Volumes/instantclient-basiclite-macos.arm64-23.3.0.23.09-02

% sh install_ic.sh

# this will create ~/Downloads/instantclient_23_3 with a bunch of files in it.

% hdiutil unmount instantclient-basiclite-macos.arm64-23.3.0.23.09.dmg

# if that does not work, then hit the eject button in Finder next to the volume

Add sqlplus

% hdiutil mount instantclient-sqlplus-macos.arm64-23.3.0.23.09.dmg

% cd /Volumes/instantclient-sqlplus-macos.arm64-23.3.0.23.09

% sh install_ic.sh

# this will add to ~/Downloads/instantclient_23_3 and you can see the sqlplise

% hdiutil unmount instantclient-sqlplus-macos.arm64-23.3.0.23.09.dmg

# if that does not work, then hit the eject button in Finder next to the volume

At this point you will have the instantclient_23_3 directory in the ~/Downloads dir.

I wanted it in opt so..

% mkdir /opt/Oracle

And, in Finder, I moved the Instant client dir to /Applications/Oracle

It looked like this...


Put it in the path.

% export PATH=$PATH:/opt/oracle/instantclient_23_3

# make sure to add it to your .zshrc or .bashrc file


Test

sqlplus system@//Toy4:1521/FREEPDB1   <<--- works!   : )




You're done!