dbeaver无法连接Oracle报错:ORA-17800、ORA-12514

环境:宿主机windows;Oracle部署环境centos7(dockerdesktop创建的容器);端口映射1521:1521

问题1:宿主机使用dbeaver连接Oracle服务,报错异常:

ORA-17800: 从读取调用中减去了一个 (CONNECTION_ID=QAd8w6vPQxifNvB3zd7s2g==)

查看监听器状态:

复制代码
[oracle@a148f323c4cf log]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-APR-2025 07:21:18

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ff2359429202)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
 TNS-12560: TNS:protocol adapter error
  TNS-00515: Connect failed because target host or object does not exist
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory

注意监听器的作用:

Oracle 监听器(Oracle Listener)是 Oracle 数据库网络架构中的核心组件,其主要作用是管理客户端与数据库服务器之间的通信,类似于电话交换机,负责接收连接请求并将其路由到正确的数据库服务。

尝试启动监听器:

复制代码
[oracle@a148f323c4cf log]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-APR-2025 06:45:55

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

Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/a148f323c4cf/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ff2359429202)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
 TNS-12560: TNS:protocol adapter error
  TNS-00515: Connect failed because target host or object does not exist
   Linux Error: 2: No such file or directory

Listener failed to start. See the error message(s) above...

[oracle@a148f323c4cf log]$ hostname
a148f323c4cf
[oracle@a148f323c4cf log]$ hostname -i
192.168.100.104
[oracle@a148f323c4cf log]$

注意到:HOST=ff2359429202并不是Oracle部署机的地址,我Oracle部署及的地址由hostname查看得知为a148f323c4cf。为了避免修改listener.ora文件,我选择直接修改本机/etc/hosts文件,在本机IP后面再新增一个别名用" "空格分隔开

重新启动lsnrctl start监听器后查看状态是成功的:

再次连接,又报错:

ORA-12514: 无法连接到数据库。服务 %s 未注册到 %s 中的监听程序。 (CONNECTION_ID=yT1PYhZiRIqkDfuoDo61zQ==)

查看lsnrctl status打印输出的监听器日志路径:

/opt/oracle/diag/tnslsnr/a148f323c4cf/listener/alert/log.xml

复制代码
<msg time='2025-04-01T07:44:07.495+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='a148f323c4cf'
 host_addr='192.168.100.104' pid='48703'>
 <txt>01-APR-2025 07:44:07 * (CONNECT_DATA=(CID=(PROGRAM=DBeaver 23?3?3 ? Main)(HOST=__jdbc__)(USER=18389))(SERVICE_NAME=ORCLCDB)(CONNECTION_ID=/VA/VRHGSFSQbai6Yzp+Cg==)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.1)(PORT=47588)) * establish * ORCLCDB * 12514
 </txt>
</msg>
<msg time='2025-04-01T07:44:07.495+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='a148f323c4cf'
 host_addr='192.168.100.104' pid='48703'>
 <txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
 </txt>
</msg>
<msg time='2025-04-01T07:44:07.506+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='a148f323c4cf'
 host_addr='192.168.100.104' pid='48703'>
 <txt>01-APR-2025 07:44:07 * (CONNECT_DATA=(CID=(PROGRAM=DBeaver 23?3?3 ? Main)(HOST=__jdbc__)(USER=18389))(SERVICE_NAME=ORCLCDB)(CONNECTION_ID=/VA/VRHGSFSQbai6Yzp+Cg==)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.1)(PORT=47604)) * establish * ORCLCDB * 12514
 </txt>
</msg>
<msg time='2025-04-01T07:44:07.506+00:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='a148f323c4cf'
 host_addr='192.168.100.104' pid='48703'>
 <txt>TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
 </txt>
</msg>

显示:TNS:listener does not currently know of service requested in connect descriptor客户端请求的服务名 ORCLCDB****未被监听器识别

再次查看监听器状态:

The listener supports no services意思是监听器当前没有识别到任何数据库服务?

为了验证,我修改listener对应/opt/oracle/product/19c/dbhome_1/network/admin/listener.ora配置文件强制绑定我客户端请求的数据库服务。

新增:

复制代码
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCLCDB) --服务名称
      (ORACLE_HOME = /opt/oracle/product/19c/dbhome_1) --安装路径
      (SID_NAME = ORCLCDB) --实例名称
    )
  )

停止lsnrctl stop后重启lsnrctl start:

dbeaver客户端尝试重连:

成功解决!

  1. 客户端无法连接Oracle服务,多半是监听器作祟,++优先使用lsnrctl status查看其状态,并多查看监听器日志文件。++
相关推荐
热爱编程的小曾21 分钟前
sqli-labs靶场 less 8
前端·数据库·less
THRUSTER1111130 分钟前
MySQL-- 函数(单行函数):数值函数, 字符串函数
数据库·mysql·函数·navicat·单行函数
橙序研工坊36 分钟前
MySQL的进阶语法7(索引-B+Tree 、Hash、聚集索引 、二级索引(回表查询)、索引的使用及设计原则
数据库·sql·mysql
Bruce-li__37 分钟前
深入理解Python asyncio:从入门到实战,掌握异步编程精髓
网络·数据库·python
小光学长1 小时前
基于vue框架的智能服务旅游管理系统54kd3(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库
Bonnie_12151 小时前
07-MySQL-事务的隔离级别以及底层原理
数据库·mysql
ETLCloud数据集成社区1 小时前
ETLCloud是如何通过Oracle实现CDC的?
数据库·oracle·etl·实时数据同步
KATA~2 小时前
解决MyBatis-Plus枚举映射错误:No enum constant问题
java·数据库·mybatis
xyliiiiiL2 小时前
一文总结常见项目排查
java·服务器·数据库
shaoing2 小时前
MySQL 错误 报错:Table ‘performance_schema.session_variables’ Doesn’t Exist
java·开发语言·数据库