Linux 无法使用sqlplus:ORA-12154:TNS连接到数据库:无法解析指定的连接标识符
我正在尝试从一台Linux服务器通过sqlplus连接到DB,但出现以下错误:Linux 无法使用sqlplus:ORA-12154:TNS连接到数据库:无法解析指定的连接标识符,linux,sqlplus,oracle12c,tns,Linux,Sqlplus,Oracle12c,Tns,我正在尝试从一台Linux服务器通过sqlplus连接到DB,但出现以下错误: SQL*Plus: Release 12.1.0.2.0 Production on Thu May 16 15:49:15 2019 Copyright (c) 1982, 2014, Oracle. All rights reserved. ERROR: ORA-12154: TNS:could not resolve the connect identifier specified Enter use
SQL*Plus: Release 12.1.0.2.0 Production on Thu May 16 15:49:15 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
我在服务器上重新安装了oracle客户端,希望它能解决这个问题,但运气不好
用法:
$>sqlplus user_name/passwd@SID
欢迎任何帮助 当您试图连接到其别名不包含在TNSNAMES.ORA文件中的数据库时,会发生这种情况。例如:
SQL> connect scott/tiger@does_not_exist
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Warning: You are no longer connected to ORACLE.
SQL>
所以,请检查您使用的TNSNAMES.ORA中写的内容
请注意,您安装的大多数Oracle软件产品都包含自己的TNSNAMES.ORA文件。如果这也是你的情况,我建议你:
在硬盘上创建一个目录,例如c:\oralib
在那里放一个TNSNAMES.ORA文件
将要访问的所有数据库复制/粘贴到该文件中
创建名为TNS_ADMIN的环境变量,该变量将指向该目录
这样,每个Oracle产品将只查看TNSNAMES.ORA文件
此外,这意味着您只需要维护文件的一个副本,而不是所有副本