You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过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:

1. Ensure your environment variables point to the 19C client (not the local 18c XE)

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 PATH variable. Move the 19C client's bin directory to the top of the list—for example, C:\app\<your-username>\product\19.0.0\client_1\bin should come before any paths related to 18c XE (like C:\app\<your-username>\product\18.0.0\xe\bin)
  • Close and reopen your command prompt, then run sqlplus -v to confirm you're using the 19C version of sqlplus
2. Set the TNS_ADMIN environment variable

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/admin directory (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
3. Double-check your tnsnames.ora and sqlnet.ora files

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 same network/admin directory as your tnsnames.ora
  • Open sqlnet.ora (it should be included in the wallet zip) and ensure it has these critical lines:
    SQLNET.WALLET_OVERRIDE = TRUE
    SSL_CLIENT_AUTHENTICATION = FALSE
    WALLET_LOCATION = (SOURCE = (METHOD = FILE)(METHOD_DATA = (DIRECTORY = .)))
    SSL_VERSION = 1.2
    
    The DIRECTORY = . means the wallet is in the same folder as sqlnet.ora—if you placed the wallet elsewhere, replace . with the full absolute path to the wallet folder
  • Verify your tnsnames.ora entry matches exactly what was in the wallet zip (no typos in host, port, or service name)
4. Test the connection with the correct syntax

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 15:22:44