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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7252286/
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-10 03:30:07  来源:igfitidea点击:

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

oracleoracle10gdatabase-connectionora-12154

提问by ErAB

The issue started when i installed the server version with already existing client version of Oracle 10g.

当我使用现有的 Oracle 10g 客户端版本安装服务器版本时,问题就开始了。

Background : The Oracle client version 10g was installed (at c:/oracle) to connect to a database residing in other country. So we can just connect to it and have limited access to it.

背景:安装了 Oracle 客户端版本 10g(在 c:/oracle)以连接到位于其他国家/地区的数据库。因此,我们可以连接到它并对其进行有限的访问。

Path => c:/oracle/ora_client/network/admin/listener.ora

路径 => c:/oracle/ora_client/network/admin/listener.ora

So to work as admin I installed 10g server at the same location c:/oracle on windows. I can now work as server.

因此,为了以管理员身份工作,我在 Windows 上的同一位置 c:/oracle 安装了 10g 服务器。我现在可以作为服务器工作了。

Path => c:/oracle/product/db_1/network/admin/listener.ora

路径 => c:/oracle/product/db_1/network/admin/listener.ora

But the issue arises when I try to connect with my application installed to setup connection as a client (to server residing in other country), it fails and throws an error ORA-12154.

但是当我尝试连接我安装的应用程序以将连接设置为客户端(到驻留在其他国家/地区的服务器)时出现问题,它失败并抛出错误 ORA-12154。

So, do I have to uninstall my server version (just in case the confusion might have arrived due to the presence of two Oracle databases)?

那么,我是否必须卸载我的服务器版本(以防万一由于存在两个 Oracle 数据库而造成混淆)?

How can I fix it? What has been the probable cause for it? Please advise!

我该如何解决?可能的原因是什么?请指教!

回答by steve

When you installed the server version it updated the environment variables to point to the server installation and not the client installation. The definition of TNS aliases is done in tnsnames.ora and no the listener.ora. So you would have to copy the already existing entries from c:/oracle/ora_client/network/admin/tnsnames.ora to c:/oracle/product/db_1/network/admin/tnsnames.ora. Be careful that you obey the tnsnames.ora format.

当您安装服务器版本时,它更新了环境变量以指向服务器安装而不是客户端安装。TNS 别名的定义是在 tnsnames.ora 中完成的,而不是在 listener.ora 中。因此,您必须将已经存在的条目从 c:/oracle/ora_client/network/admin/tnsnames.ora 复制到 c:/oracle/product/db_1/network/admin/tnsnames.ora。请注意遵守 tnsnames.ora 格式。

回答by user4945023

I faced this error today. Spent a lot of time checking what I did wrong while configuring listener. Even after I configured it using netca I still had the same error:

我今天遇到了这个错误。在配置侦听器时花了很多时间检查我做错了什么。即使在我使用 netca 配置它之后,我仍然有同样的错误:

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

ORA-12154: TNS: 无法解析指定的连接标识符

It appeared that the cause was bad password for sys containing '@' character.

原因似乎是包含“@”字符的 sys 密码错误。

For example when you connect as below:

例如,当您按如下方式连接时:

$sqlplus sys as sysdba

The response is

回应是

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 27 08:24:19 2015

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

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

SQL*Plus:2015 年 5 月 27 日星期三 08:24:19 发布 11.2.0.4.0 生产版

版权所有 (c) 1982, 2013,甲骨文。版权所有。

输入密码:ple@se 错误:ORA-12154:TNS:无法解析指定的连接标识符

That is it. Very easy case.

这就对了。很容易的情况。