ORA-12537: Network Session: End of file
最近开发组同事使用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:通信通道的文件结尾”
查了一下官方文档关于azure的function连接数据库的相关知识,因为连接池缘故,数据库的会话一直处于inactive状态,而当达到条件时(空闲超过90分钟),就被作业清理掉,而当后面应用访问时,由于连接池的相关会话被清理掉,从而报错。
上一篇: MySQL 数据查询
下一篇: MySQL索引设计需要考虑哪些因素?