我遇到此错误TNS:尝试从Linux远程计算机连接到Oracle DB时,错误地指定了网络服务名称。
我看到很多相同的帖子,但没有帮助,所以开始新的帖子。
详情
我在VMWare Fusion上有一个关于VirtualBox和Oracle DB的linux。两者都安装在Mac El-capitan上。
我可以使用sqlplus命令与oracle客户端12.1.0.2连接到Oracle DB。但不是来自Linux。
已配置设置
根据所有其他帖子的建议,我已涵盖所有设置:
我的tnsnames.ora
:
# tnsnames.ora Network Configuration File:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.YYY.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
AAA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.YYY.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
来自Mac的 sqlplus
连接 - 成功尝试
Tests-MacBook-Pro:~ test$ /opt/oracle/instantclient_12_1/sqlplus abc/abc@XXX.YYY.com:1521/XE
SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 6 13:43:52 2016
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL>
来自Linux的 sqlplus
连接 - UnSuccessful Attempt
[sushil@linux test-linux-setup]$ /opt/oracle/instantclient_12_1/sqlplus abc/abc@XXX.YYY.com:1521
SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 4 22:37:00 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-21561: OID generation failed
Enter user-name: ***
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name: ***
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
来自linux的1521端口的Telnet连接
sushil@linux test-linux-setup]$ telnet XXX.YYY.com 1521
Trying 192.168.34.128...
Connected to XXX.YYY.com.
Escape character is '^]'.
^]q
telnet> q
Connection closed.
有人能说清楚为什么会这样吗?