欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ORA-12537: Network Session: End of file

程序员文章站 2022-06-25 08:21:10
最近开发组同事使用Azure的Function App访问公司内部的Oracle数据库时,偶尔会遇到“ORA-12537: Network Session: End of file”这个错误。关于ORA-12537的详细信息如下: [oracle@DB-Server ~]$ oerr ora 125... ......

最近开发组同事使用azurefunction 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:

  1. there are too many connections being open by the application.
  2. there are configuration issues in the sqlnet.ora, protocol.ora and listener.ora files.
  3. database is shut down (maybe for nightly backup), but connection to database was kept by client.
  4. a timeout occurred on the client connection.
  5. a firewall closed idle connections.
  6. 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;

    

 

azurefunction app测试验证发现报ora-12537: network session: end of file 。注意alter system kill session 'xxx,xxx' immediate;也是同样的错误。

 

 

但是如果你使用sql*plus等工具(使用sql*net连接数据库),测试发现报ora-03113:通信通道的文件结尾

 

 

 

 

查了一下官方文档关于azurefunction连接数据库的相关知识,因为连接池缘故,数据库的会话一直处于inactive状态,而当达到条件时(空闲超过90分钟),就被作业清理掉,而当后面应用访问时,由于连接池的相关会话被清理掉,从而报错。