ORA-12537: Network Session: End of file
2018-12-18 17:04 潇湘隐者 阅读(6707) 评论(0) 编辑 收藏 举报最近开发组同事使用Azure的Function App访问公司内部的Oracle数据库时,偶尔会遇到“ORA-12537: Network Session: End of file”这个错误。关于ORA-12537的详细信息如下:
[oracle@DB-Server ~]$ oerr ora 12537
12537, 00000, "TNS:connection closed"
// *Cause: "End of file" condition has been reached; partner has disconnected.
// *Action: None needed; this is an information message.
按照官方文档,引起ORA-12537的错误原因很多,如下所示:
ORA-12537 is an informational message and means that the connection has been closed. This error message can happen due to any of the following reasons:
- There are too many connections being open by the application.
- There are configuration issues in the sqlnet.ora, protocol.ora and listener.ora files.
- Database is shut down (maybe for nightly backup), but connection to database was kept by client.
- A timeout occurred on the client connection.
- A firewall closed idle connections.
- There is a path name that is too long for the Oracle TNS client on Windows. See Note:263489.1
一一分析、排除后,怀疑我设定的一个定期清理超过90分钟空闲会话的作业导致了这个问题,具体参考“ORACLE定期清理INACTIVE会话”,测试了一下,我们通过V$SESSION找到对应的会话,然后使用下面SQL终止会话。
SQL> ALTER SYSTEM DISCONNECT SESSION 'xxx,xxx' IMMEDIATE;
Azure的Function App测试验证发现报“ORA-12537: Network Session: End of file” 。注意:ALTER SYSTEM KILL SESSION 'xxx,xxx' IMMEDIATE;也是同样的错误。
但是如果你使用SQL*Plus等工具(使用SQL*Net连接数据库),测试发现报ORA-03113:通信通道的文件结尾“,而不是ORA-12537这个错误,如下所示:
查了一下官方文档关于Azure的Function(Function App)连接数据库的相关知识,因为连接池缘故,应用程序关闭会话后,连接池对应的数据库会话一直处于INACTIVE状态,而当达到条件时(空闲时间超过90分钟),就被作业清理掉,而此时如果Azure的Function应用再次访问数据库时,由于连接池的相关会话被清理掉了,从而报错。

【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
2014-12-18 Linux SendMail发送邮件失败诊断案例(二)
2013-12-18 SQL SERVER 2008 Reporting Services 的一些小问题集合
2013-12-18 Linux忘记root密码怎么办?