Oracle:如何像检测sqlplus一样检测客户端进程终止? [英] Oracle: How to detect client process termination like it works for sqlplus?

查看:102
本文介绍了Oracle:如何像检测sqlplus一样检测客户端进程终止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的连接到Oracle 10g数据库的应用程序中存在以下问题:

I have the following problem in my application which connects to an Oracle 10g database:

当我的客户端崩溃时,或者通过任务管理器终止了该过程,或者客户端失去了一段时间的连接,v $ session视图中的相应条目仍然保留.

When my client crashes, or the process is terminated via task manager, or the client loses connection for a while, the appropriate entry in the v$session view remains.

现在,当我使用sqlplus连接到数据库并通过任务管理器杀死sqlplus.exe时,会话条目几乎立即被删除.

Now when I connect to the database with sqlplus, and i kill sqlplus.exe through the task manager, the session entry gets deleted almost instantly.

出于各种原因,后期行为对于我的应用程序将是首选.

Latter behaviour would be preferred for my application for various reasons.

sqlplus有什么不同之处,我也可以在自己的应用程序中做到吗?

What does sqlplus do differently, and can I do it as well in my own application(s)?

推荐答案

进一步的调查表明,尽管sqlplus在终止进程时的行为有所不同,但实际上,当第二次插入网络电缆时,其行为相同.悬挂会话将保留在服务器上.

Further investigation showed that although sqlplus does behave differently when killing the process, in fact it behaves the same way when the network cable is plugged out for a second => The dangling session will stay on the server.

我现在已经创建了一个用户配置文件,其中有限的idle_time分配给了我需要的用户.后台线程发送"keepalive"查询,以防止PMON通过SNIPED连接.

I have now created a user profile with a limited idle_time which is assigned to the users I need. A background thread sends "keepalive" queries to keep the connection from being SNIPED by PMON.

查看我的其他问题 Oracle:idle_time似乎被忽略了如果您对我所做的事情感兴趣,并且看到了使idle_time工作所需要做的回答.

See my other question Oracle: idle_time appears to be ignored if you are interested in what I did and see the answer on what you have to do to make idle_time work.

这篇关于Oracle:如何像检测sqlplus一样检测客户端进程终止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆