tnsping Not Working on macOS (zsh) – Connecting to Oracle 26ai Autonomous Database Without It
Recently, while working on Oracle Autonomous Database 26ai, I encountered the following error on macOS:
zsh: command not found: tnsping
At first, it looked like something was missing from my Oracle client installation. However, the actual answer is that you don’t need tnsping when using SQLcl to connect to Autonomous Database.
Instead, you can connect directly using the wallet configuration.
Step 1: Set the Wallet Location
Export the wallet directory so SQLcl knows where to find the connection configuration.
export TNS_ADMIN=/Users/karandodwal/git/code/oracle/wallet
Step 2: Required Wallet Files
Your wallet directory should contain files similar to the following:
(base) karandodwal@Karans-MacBook-Air wallet % ls -ltr
total 152
-rw-r--r--@ 1 karandodwal staff 3021 22 Mar 17:33 truststore.jks
-rw-r--r--@ 1 karandodwal staff 1245 22 Mar 17:33 tnsnames.ora
-rw-r--r--@ 1 karandodwal staff 114 22 Mar 17:33 sqlnet.ora
-rw-r--r--@ 1 karandodwal staff 3030 22 Mar 17:33 README
-rw-r--r--@ 1 karandodwal staff 691 22 Mar 17:33 ojdbc.properties
-rw-r--r--@ 1 karandodwal staff 3191 22 Mar 17:33 keystore.jks
-rw-r--r--@ 1 karandodwal staff 7097 22 Mar 17:33 ewallet.pem
-rw-r--r--@ 1 karandodwal staff 6312 22 Mar 17:33 ewallet.p12
-rw-r--r--@ 1 karandodwal staff 6357 22 Mar 17:33 cwallet.sso
-rw-r--r--@ 1 karandodwal staff 25332 22 Mar 23:20 Wallet_PYDB.zip
These files are downloaded when you download the Autonomous Database Wallet from Oracle Cloud.
Step 3: Connect Using SQLcl
Once the wallet path is configured, simply run your connection command.
In my case, I use an alias called atp.
(base) karandodwal@Karans-MacBook-Air ~ % atp
SQLcl: Release 24.4 Production on Sun Mar 22 23:28:13 2026
Copyright (c) 1982, 2026, Oracle. All rights reserved.
Last Successful login time: Sun Mar 22 2026 23:27:33 +05:30
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.2.0 - Production
Version 23.26.1.2.0
Step 4: Verify the Connection
You can verify the pluggable database using:
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
------ -------------------------- ---------- ----------
600 RE2D3BGG7YWWTP7_PYDB READ WRITE NO
Key Takeaway
If you see:
zsh: command not found: tnsping
Don’t worry.
When working with Autonomous Database and SQLcl, you typically don’t need tnsping. As long as:
- The wallet is downloaded
- TNS_ADMIN is set correctly
- SQLcl is installed
You can connect directly.
This approach works well on macOS using zsh and is a simple way to connect to Autonomous Database using the wallet.
No comments:
Post a Comment