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

本文介绍了解决Oracle数据库登录过程中遇到的ORA-12154错误的方法。通过修改sqlnet.ora文件中的NAMES.DIRECTORY_PATH参数,增加'EZCONNECT'选项,成功解决了无法通过服务名连接数据库的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误描述:

 在进行ADG实验当中发现本地db服务器不能使用listener.ora文件中的服务名进行登录,命令如下:

[oracle@dba1 admin]$ sqlplus  sys/oracle@dba1:1521/BEIJING_DGMGRL as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 26 17:15:38 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


问题分析:

 本以为是服务名区分大小写或者服务名设置错误,后经过测试都排除了。最后经过网友的指点才发现原来是sqlnet.ora文件设置问题。


解决方法:

默认sqlnet.ora 文件中 “NAMES.DIRECTORY_PATH= (TNSNAMES)”,后设置成“NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)”解决,增加了参数‘EZCONNECT’ 问题解决了。


[oracle@dba1 admin]$ cat sqlnet.ora 
# sqlnet.ora Network Configuration File: /u01/oracle/product/11.2.0.4/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /u01/oracle


[oracle@dba1 admin]$ sqlplus  sys/oracle@dba1:1521/BEIJING_DGMGRL as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 26 17:43:39 2014
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> 


小结:

oracle要学习的东西还非常的多,一个非常小的细节让我困感的很长时间,许多东西还是要注意细节。

====================================================================================

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任! 谢谢合作!

QQ:164798858@qq.com

Sina:Weibo.com/kaijunfeng

Gmail:Kaijunfeng@gmail.com


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值