oracle TNS: 无法解析指定的连接标识符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16209728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:36:52  来源:igfitidea点击:

TNS:could not resolve the connect identifier specified

oracleoracle11goracleclientora-12154

提问by user650521

I have oracle server 11g installed on my windows 7 machine. I have to install this server from a remote machine. Remote machine is a 64 bit system,with Ubuntu 12.10. To access the server I installed Oracle instant client and configured eveything.

我的 Windows 7 机器上安装了 oracle server 11g。我必须从远程机器安装这个服务器。远程机器是 64 位系统,Ubuntu 12.10。为了访问服务器,我安装了 Oracle 即时客户端并配置了所有内容。

ORACLE_HOME, TNS_ADMIN, PATH, LD_LIBRARY_PATH all are set, and are pointing to correct locations.

ORACLE_HOME、TNS_ADMIN、PATH、LD_LIBRARY_PATH 都已设置,并指向正确的位置。

My tnsname.ora file:

我的 tnsname.ora 文件:

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ravi)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.xxx.com)
    )
  )

My sqlnet.ora file

我的 sqlnet.ora 文件

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

My tnslistener on the server is up and running.

我在服务器上的 tnslistener 已启动并正在运行。

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0
         LOCAL SERVER
Service "orcl.xxx.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:221 refused:0 state:ready
         LOCAL SERVER
Service "orclXDB.xxx.com" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ravi, pid: 4844>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ravi.xxx.com)(PORT=49239))
The command completed successfully

Even after setting all these, Im not able to connect to the server.

即使设置了所有这些,我也无法连接到服务器。

When I issue sqlplus user1@orclcommand I get

当我发出sqlplus user1@orcl命令时,我得到

ravi@ubuntu:~/app/ravi/product/11.2.0/dbhome_1/bin$ sqlplus user1@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 25 01:17:01 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Enter password: 
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

I have seen all these posts,

这些帖子我都看过

Sqlplus login error when using bash variables: SP2-0306: Invalid option

使用 bash 变量时 Sqlplus 登录错误:SP2-0306: Invalid option

ora-12154 could not resolve... with oracle instant client

ora-12154 无法解析...使用 oracle 即时客户端

and infact many other posts, but none of them is resolving my issue.

事实上还有许多其他帖子,但没有一个能解决我的问题。

Requesting for help

请求帮助

Thanks in Advance

提前致谢

回答by NavyPier

Your listener is not properly configured, i think...

你的监听器配置不正确,我想......

Could you upload:

能不能上传:

.- listener.ora ?

.- listener.ora ?

.- netstat -na|grep 1521

.- netstat -na|grep 1521

This is one of my output of "services"

这是我的“服务”输出之一

LSNRCTL> services

LSNRCTL> 服务

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Services Summary... Service "eva" has 1 instance(s). Instance "eva1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:39 refused:0 state:ready

连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) 服务摘要... 服务“eva”有 1 个实例。实例 "eva1", 状态 READY, 有 1 个用于此服务的处理程序... 处理程序: "DEDICATED" created:39 denied:0 state:ready

And my netstat

还有我的网络统计

[oracle@laborac1 ~]$ netstat -na|grep 1521

[oracle@laborac1 ~]$ netstat -na|grep 1521

tcp 0 0 192.168.113.152:1521 0.0.0.0:* LISTEN

tcp 0 0 192.168.113.152:1521 0.0.0.0:* 听

tcp 0 0 192.168.113.150:1521 0.0.0.0:* LISTEN

tcp 0 0 192.168.113.150:1521 0.0.0.0:* 听