暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

ORA-12514 TNSlistener does not currently know of service requested in connect descriptor

原创 不吃草的牛_Nick 2022-11-04
1407

oerr ora 12514
12514, 00000, "TNS:listener does not currently know of service requested in connect descriptor"
// *Cause: The listener received a request to establish a connection to a
// database or other service. The connect descriptor received by the listener
// specified a service name for a service (usually a database service)
// that either has not yet dynamically registered with the listener or has
// not been statically configured for the listener. This may be a temporary
// condition such as after the listener has started, but before the database
// instance has registered with the listener.
// *Action:
// - Wait a moment and try to connect a second time.
// - Check which services are currently known by the listener by executing:
// lsnrctl services <listener name>
// - Check that the SERVICE_NAME parameter in the connect descriptor of the
// net service name used specifies a service known by the listener.
// - If an easy connect naming connect identifier was used, check that
// the service name specified is a service known by the listener.
// - Check for an event in the listener.log file.


执行请求的操作时遇到错误:
Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
供应商代码 12514


Step 1: 首先检查客户端的tnsnames.ora里面的host、port、service_name等是否正确
myvm =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.20.57.15)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = gsp.localdomain)
)
)


Step 2:检查确认数据库实例是否启动。
select status from v$instance;


当数据库实例异常关闭,也会出现ORA-12514错误,如下所示
(如果我关闭一数据库实例,然后使用SQL*Plus测试连接数据库就会遇到这个错误):

C:\Users>sqlplus system/123456@mydb
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 4月 12 11:56
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务


Step 3:检查网络是否正常,tnsping能否ping通
tnsping myvm


监听服务也正常,没有问题
[oracle@DB-Server admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-APR-2017 10:36:40
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-APR-2017 10:31:20
Uptime 0 days 0 hr. 5 min. 20 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/DB-Server/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB-Server.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully


Step 4:检查$ORACLE_BASE/diag/tnslsnr/DB-Server/listener/alert下的日志,
发现host_addr为10.20.34.76,实际IP地址不是这个。
因为监听文件里面我使用的 hostname DB-Server.localdomain,所以赶紧检查/etc/hosts的配置


[root@DB-Server ~]# ifconfig
eth0 Link encap:Ethernet HWaddr B0:83:FE:55:32:E5
inet addr:10.20.57.15 Bcast:10.20.57.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2363981 errors:0 dropped:0 overruns:0 frame:0
TX packets:180048 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:225925147 (215.4 MiB) TX bytes:14349633 (13.6 MiB)
Interrupt:233 Base address:0x4000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3692 errors:0 dropped:0 overruns:0 frame:0
TX packets:3692 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2982961 (2.8 MiB) TX bytes:2982961 (2.8 MiB)

[root@DB-Server ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
10.20.34.76 DB-Server.localdomain DB-Server
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6


果然发现/etc/hosts下配置为10.20.34.76, 具体原因是因为IT部门调换办公室,从三楼撤到二楼,
将这台PC搬下来后,服务器IP地址变化了,修改/etc/hosts,然后重启监听服务,问题解决。




「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论