前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >查询listener的日志排除不能登录的错误

查询listener的日志排除不能登录的错误

作者头像
用户8196625
发布2023-04-06 18:00:20
5890
发布2023-04-06 18:00:20
举报
文章被收录于专栏:oracleaceoracleace

一个开发人员反映navicat不能登录Oracle数据库,请我帮忙看看:

我查看listener的日志里有下面的记录

代码语言:javascript
复制
<msg time='2022-03-09T08:05:44.750+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='ecology-data'
 host_addr='192.168.99.99'>
 <txt>09-MAR-2022 08:05:44 * (CONNECT_DATA=(SERVICE_NAME=ORCL)(CID=(PROGRAM=C:\Program?Files\PremiumSoft\Navicat?Premium?15\navicat.exe)(HOST=LENOVO-X270)(USER=vito))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.9.49)(PORT=58419)) * establish * ORCL * 12514
 </txt>
</msg>
<msg time='2022-03-09T08:05:44.750+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='ecology-data'
 host_addr='192.168.99.99'>
 <txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
 </txt>
</msg>

查询一下TNS-12514的错误:

代码语言:javascript
复制
$ oerr tns 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.

显然是Oracle的服务名设置错误,orcl的服务名是Oracle数据库最常用的服务名,难道会错?仔细看看listener的状态:

代码语言:javascript
复制
$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-MAR-2022 08:03:50

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.99.99)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                18-FEB-2022 02:44:00
Uptime                    19 days 5 hr. 19 min. 50 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracledata/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /oracledata/oracle/diag/tnslsnr/aaaa-data/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.99.99)(PORT=1521)))
Services Summary...
Service "orcls" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

发现服务名居然是orcls!把navicat里面的服务名对应改过来即可。实际上使用instance名也可以进行连接。


总结:

客户端连接失败的故障很常见,通常查询listener的日志就可以找到原因。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-03-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 oracleace 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档