When working with Oracle Database 23ai, you may encounter an error that looks serious, confusing, and network-related—but turns out to be caused by a very small environment misconfiguration.
One such error is:
ORA-12547: TNS:lost contact
SP2-0157: unable to CONNECT to ORACLE after 3 attempts
In this blog, we’ll focus only on a specific and proven cause in Oracle 23ai:
An incorrect
ORACLE_HOMEvalue ending with a trailing slash (/).
This post is written for DBAs and engineers who want a clear, human explanation, without unnecessary detours—while being SEO-friendly and practical.
The Context: SYSDBA Connection Fails in Oracle 23ai
You log in as the Oracle OS user and run:
sqlplus / as sysdba
Instead of connecting, Oracle responds with:
ORA-12547: TNS:lost contact
You try again. Same error.
No password prompt.
No listener error.
No useful message in the alert log.
At this point, many DBAs assume:
- A listener issue
- Binary permission problems
- Missing OS libraries
But in this scenario, none of those are the issue.
The Real Cause: ORACLE_HOME Ends With /
The environment variable was set as:
export ORACLE_HOME=/u01/app/oracle/product/23.2.6.0/dbhome_1/
That single trailing slash is enough to break a local SYSDBA connection in Oracle 23ai.
Even though Linux accepts directory paths with a trailing slash, Oracle 23ai does not reliably handle it during local BEQ connections.
Why This Happens in Oracle 23ai
When you run:
sqlplus / as sysdba
Oracle uses a local BEQ (bequeath) connection, not TCP networking. Internally, Oracle:
- Reads the
ORACLE_HOMEvalue - Constructs paths to binaries and shared libraries
- Attempts to spawn a local Oracle server process
- Loses communication if the process exits immediately
In Oracle Database 23ai, path handling is stricter than older releases.
A trailing slash can cause invalid internal path resolution, leading the server process to terminate before communication is established.
SQL*Plus then reports the generic error:
ORA-12547: TNS:lost contact
No authentication occurs.
No detailed trace is written.
The connection simply drops.
Why This Error Is So Misleading
This issue is difficult to diagnose because:
- The
ORACLE_HOMEpath looks correct - Linux tools don’t complain about the trailing
/ - The error message points to TNS, not environment variables
- Oracle provides no explicit warning about malformed paths
As a result, DBAs often spend hours checking things that are completely unrelated.
The Fix: Remove the Trailing Slash
The solution is simple and immediate.
❌ Incorrect
export ORACLE_HOME=/u01/app/oracle/product/23.2.6.0/dbhome_1/
✅ Correct
export ORACLE_HOME=/u01/app/oracle/product/23.2.6.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
Now retry:
sqlplus / as sysdba
✅ The connection works instantly—no restart, no relink, no listener changes.
Why This Appears More After Upgrading to 23ai
This issue commonly shows up:
- After upgrading from 19c to 23ai
- When creating a new Oracle home manually
- When copying environment variables from scripts or documentation
- When
.bash_profileor.bashrcfiles are edited quickly
Oracle 23ai is less forgiving of small environment mistakes, which is actually a good thing—but it does mean minor issues surface as hard failures.
Best Practice for Oracle 23ai DBAs
Always validate your environment before troubleshooting deeper issues:
echo $ORACLE_HOME
which sqlplus
Make sure:
ORACLE_HOMEdoes not end with/sqlplusis coming from$ORACLE_HOME/bin
This simple check can prevent one of the most confusing ORA-12547 scenarios in Oracle 23ai.
Key Takeaways
✔ ORA-12547 in Oracle 23ai can be caused purely by an incorrect ORACLE_HOME
✔ A trailing slash (/) is enough to break local SYSDBA connections
✔ The error is misleading and not network-related
✔ Fixing the environment resolves the issue instantly
Final Thoughts
In Oracle Database 23ai, small configuration details matter more than ever.
This ORA-12547 case is a perfect reminder that environment variables are part of your database configuration, not just shell settings.
If you remember only one thing from this blog:
Never end
ORACLE_HOMEwith a trailing slash—especially in Oracle 23ai.





