ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect 问题的解决!

本文介绍了解决ORA-12514:TNS:listenercouldnotresolve SERVICE_NAME错误的方法。通过检查tnsnames.ora和listener.ora文件的一致性,并调整服务名称设置,成功恢复了数据库连接。

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

应用不能连接数据库了。应用日志里发现如下错误:

ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect。

解决办法如下:

$ tnsping arsprd.emea.net

TNS Ping Utility for Solaris: Version 9.2.0.7.0 - Production on 22-JUN-2010 04:07:53

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
/global/oracle/orahome1/product/9.2.0/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.16.224.200)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ARSPRD.EMEA.NET)))
OK (0 msec)

注意:SERVICE_NAME = ARSPRD.EMEA.NET。
$ sqlplus aradmin@arsprd.emea.net

SQL*Plus: Release 9.2.0.7.0 - Production on Tue Jun 22 04:08:12 2010

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

ERROR:
ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect
descriptor

$ lsnrctl

LSNRCTL for Solaris: Version 9.2.0.7.0 - Production on 22-JUN-2010 04:08:54

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 9.2.0.7.0 - Production
Start Date                22-JUN-2010 04:07:36
Uptime                    0 days 0 hr. 1 min. 20 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /global/oracle/orahome1/product/9.2.0/network/admin/listener.ora
Listener Log File         /global/oracle/orahome1/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Orc01ud-lon01)(PORT=1521)))
Services Summary...
Service "ARSPRD.sevenspace.net" has 1 instance(s).
  Instance "ARSPRD", status READY, has 1 handler(s) for this service...
The command completed successfully

注意:在linster里:Service "ARSPRD.sevenspace.net"

修改listener.ora or tnsnames.ora文件其中一个,让其与另一个文件里的配置一致就可以了.

这里的listener是动态注册的,服务名可以在初始化参数里修改。

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.7.0 - Production on Tue Jun 22 04:06:56 2010

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
mts_service                          string      ARSPRD
service_names                        string      ARSPRD
SQL> alter system set service_names='ARSPRD.EMEA.NET';

System altered.

SQL>

这时再连接就可以了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值