【数据源】连接Oracle失败 Listener refused the connection with the following error: ORA-12505

连接Oracle失败 Listener refused the connection with the following error: ORA-12505

使用场景

数据源平台配置了Oracle,在其它工具测试能够正常连接,但数据源平台在确认配置无误情况下点击测试连接提示失败,报错信息提示:Listenerrefused the connection with the following error: ORA-12505,TNS:listener does not currently know of SID given in connect descriptor

解决方案

原因是Oracle有两种连接类型,
1.使用服务名配置方式:jdbc:oracle:thin:@:1521/orclpdb
2.使用SID,配置方式:jdbc:oracle:thin:@:1521:orcl12c
端口后面使用:时jdbc实例会使用SID的方式,而使用/则是使用服务名。
根据Oracle开始设置的为准。当然一般情况下第二种连接只要是两种方式都开启的情况下也是可以进行连接的。
步骤:
把jdbc配置里的orcl的冒号配置为/
在这里插入图片描述
效果:
替换后测试显示连接成功
在这里插入图片描述

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
数据库连接报错"Listener refused the connection with the following error: ORA-12505"是由于TNS Listener无法识别连接描述符中给定的SID所引起的。这个错误通常表示数据库实例的SID无法被正确识别或连接。 解决这个问题的方法有以下几种: 1. 确认数据库实例的SID: 确保数据库实例的SID在连接描述符中正确配置。可以通过运行命令`lsnrctl services`来查看监听器中注册的数据库服务和SID。 2. 检查监听器配置: 确保监听器的配置文件(tnsnames.ora)中包含正确的数据库服务和SID。确保SID和服务与连接描述符中的信息匹配。 3. 检查监听器状态: 使用命令`lsnrctl status`来检查监听器的状态。如果监听器已停止或未运行,请启动监听器并重新测试数据库连接。 4. 检查网络连接: 确保数据库服务器和客户端之间的网络连接正常。可以使用ping命令测试网络的连通性。 5. 检查防火墙设置: 如果有防火墙存在,请确保允许数据库服务器和客户端之间的通信。 6. 使用正确的连接字符串: 确保在连接描述符中使用正确的连接字符串,包括主机名、端口号、SID和服务名等。 综上所述,解决数据库连接报错"Listener refused the connection with the following error: ORA-12505"的方法包括确认数据库实例的SID、检查监听器配置、检查监听器状态、检查网络连接、检查防火墙设置以及使用正确的连接字符串。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [解决数据库连接报错Listener refused the connection with the following error: ORA-12505](https://blog.csdn.net/rhyy1230/article/details/103558587)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *3* [【数据源连接Oracle失败 Listener refused the connection with the following error: ORA-12505](https://blog.csdn.net/weixin_40142258/article/details/131169923)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值