无法通过sqlplus连接Oracle 19C Cloud数据库求助
Hey there! Let's work through this ORA-12154 issue together—since you can connect via SQL Developer but not sqlplus, we know the wallet and core connection details are valid, so it's almost certainly a configuration mismatch with your Oracle client setup. Here are the key checks to fix this:
Your machine has both Oracle 18c XE and 19C client installed, which often causes path conflicts. SQL Developer might be explicitly using the 19C client settings, but sqlplus could be picking up the XE binaries first.
- Open your system environment variables (Right-click "This PC" → Properties → Advanced System Settings → Environment Variables)
- In the System Variables section, find the
PATHvariable. Move the 19C client'sbindirectory to the top of the list—for example,C:\app\<your-username>\product\19.0.0\client_1\binshould come before any paths related to 18c XE (likeC:\app\<your-username>\product\18.0.0\xe\bin) - Close and reopen your command prompt, then run
sqlplus -vto confirm you're using the 19C version of sqlplus
sqlplus needs to know exactly where your updated tnsnames.ora and wallet files are stored. Without this variable, it might default to the 18c XE's network directory instead of your 19C client's.
- Add a new system variable named
TNS_ADMIN - Set its value to the full path of your 19C client's
network/admindirectory (e.g.,C:\app\<your-username>\product\19.0.0\client_1\network\admin) - Restart your command prompt and run
echo %TNS_ADMIN%to verify the variable is active
Even though you copied the connection string from the wallet, small formatting issues or missing files can break things:
- Confirm all wallet files (like
cwallet.sso,ewallet.p12) are in the samenetwork/admindirectory as yourtnsnames.ora - Open
sqlnet.ora(it should be included in the wallet zip) and ensure it has these critical lines:
TheSQLNET.WALLET_OVERRIDE = TRUE SSL_CLIENT_AUTHENTICATION = FALSE WALLET_LOCATION = (SOURCE = (METHOD = FILE)(METHOD_DATA = (DIRECTORY = .))) SSL_VERSION = 1.2DIRECTORY = .means the wallet is in the same folder assqlnet.ora—if you placed the wallet elsewhere, replace.with the full absolute path to the wallet folder - Verify your
tnsnames.oraentry matches exactly what was in the wallet zip (no typos in host, port, or service name)
Make sure you're using the exact connect identifier from your tnsnames.ora file. For example:
sqlplus your_cloud_username/your_cloud_password@your_tns_identifier
If your wallet is configured for passwordless authentication, you can also try:
sqlplus /@your_tns_identifier
Once you've worked through these steps, restart your command prompt and test the connection again. This should resolve the TNS resolution error since we're aligning sqlplus with the same configuration that works for SQL Developer.
内容的提问来源于stack exchange,提问作者Learner

