楼主: weijsh

JDBC连上来的session断线后如何立刻kill掉?

[复制链接]
论坛徽章:
42
ITPUB北京香山2007年会纪念徽章
日期:2007-01-24 14:35:022011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:56管理团队成员
日期:2011-05-07 01:45:08ITPUB十周年纪念徽章
日期:2011-11-01 16:20:282012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:23
21#
发表于 2005-3-7 10:42 | 只看该作者
通过v$process和v$session可以找SPID来的,然后杀吧

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2009-02-02 10:53:59
22#
发表于 2005-3-7 10:52 | 只看该作者
最初由 lovexueer 发布
[B]用这个吧,PROCESSVIEW
另外你可以试试weijsh兄的方法,修改sqlnet,这个我没用过。 [/B]



processview我找了好久都没找到,能传上来吗

使用道具 举报

回复
论坛徽章:
168
马上加薪
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-01-04 11:49:54蜘蛛蛋
日期:2011-12-05 16:08:56ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41设计板块每日发贴之星
日期:2011-07-22 01:01:02ITPUB官方微博粉丝徽章
日期:2011-06-30 12:30:16管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:33
23#
发表于 2005-3-7 10:58 | 只看该作者
Key Word :
Dead Connection Detection

wish the following document can help u:

1.
Dead Connection Detection (DCD) is a feature of SQL*Net 2.1 and later, including
Net8. It detects when a partner in a SQL*Net V2 client/server or server/server
connection has terminated unexpectedly, and releases the resources associated
with it.

DCD is intended primarily for environments in which clients power down their
systems without disconnecting from their Oracle sessions, a problem characteristic
of networks with PC clients.

DCD is initiated on the server when a connection is established. At this
time SQL*Net reads the SQL*Net parameter files and sets a timer to generate an
alarm. The timer interval is set by providing a non-zero value in minutes for
the SQLNET.EXPIRE_TIME parameter in the sqlnet.ora file.

2.
On most OS'es (even more recent versions of Windows) if a process exits
abnormally or is killed by an administrator, the OS will still gracefully
clean up resources associated with that process including the network
connection(s). It will tell the server on the other end that it is closing
the network connection. DCD is still useful for times when there are problems
with the physical network (e.g. ethernet cable falls off the machine) or if the
OS kernel panics and crashes (e.g. blue screen of death) before it can close
the network connections. It may have another side benefit with certain load
balancing hardware, that may prematurely abort connections it thinks have been
idle too long, by sending a dummy packet to the client periodically.

Under no circumstances should you rely 100% on Dead Connection Detection.
It was developed to handle clients that have abnormally exited. Clients
should always exit their applications gracefully. It is the responsibility of
the application developer to make this possible. DCD is intended only to clean
up after abnormal events.

DCD is much more resource-intensive than similar mechanisms at the protocol
level, so if you depend on DCD to clean up all dead processes, that will put
an undue load on the server.

Clearly it is advantageous to exit applications cleanly in the first place.

使用道具 举报

回复
论坛徽章:
1
会员2006贡献徽章
日期:2006-04-17 13:46:34
24#
 楼主| 发表于 2005-3-7 11:09 | 只看该作者
最初由 CUTE_ORACLE 发布
[B]

这样的话就是客户断与DB直接通信了!
觉得,在sqlnet.ora 设
SQLNET.EXPIRE_TIME=10 方法是应该可以的.
可能时间太长..你试试..
SQLNET.EXPIRE_TIME=0 [/B]


java写的exe是通过jdbc连接数据库,另外还有web服务是通过weblogic连上来的,SQLNET.EXPIRE_TIME=0会不会影响到weblogic? 如果影响的话不是隔几秒就要重新登录系统?

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2009-02-02 10:53:59
25#
发表于 2005-3-7 11:21 | 只看该作者
最初由 weijsh 发布
[B]

java写的exe是通过jdbc连接数据库,另外还有web服务是通过weblogic连上来的,SQLNET.EXPIRE_TIME=0会不会影响到weblogic? 如果影响的话不是隔几秒就要重新登录系统? [/B]


不管对weblogic有没有影响,你都要找个环境测试一下再用到在线系统上啊,别人如果说没有影响,万一用了有影响呢?

使用道具 举报

回复
论坛徽章:
2
生肖徽章2007版:鼠
日期:2008-01-02 17:35:532011新春纪念徽章
日期:2011-02-18 11:43:36
26#
发表于 2005-3-7 11:34 | 只看该作者
husthxd贴子说的很清楚。
DCD给服务器造成了不必要的负担。
通过OS kill方法,资源确实release的好

processview偶也没有找到,看下边这个是否有用。
http://www.onlinedown.net/soft/1409.htm

使用道具 举报

回复
论坛徽章:
168
马上加薪
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-01-04 11:49:54蜘蛛蛋
日期:2011-12-05 16:08:56ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41设计板块每日发贴之星
日期:2011-07-22 01:01:02ITPUB官方微博粉丝徽章
日期:2011-06-30 12:30:16管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:33
27#
发表于 2005-3-7 11:55 | 只看该作者
最初由 weijsh 发布
[B]

java写的exe是通过jdbc连接数据库,另外还有web服务是通过weblogic连上来的,SQLNET.EXPIRE_TIME=0会不会影响到weblogic? 如果影响的话不是隔几秒就要重新登录系统? [/B]


SQLNET.EXPIRE_TIME是用来监测DCD的.不会对其他正常的数据库连接有影响了.
windows平台下用orakill清除thread,unix平台下用kill -9清除.
http://blog.itpub.net/post/11/20675

使用道具 举报

回复
论坛徽章:
1
会员2006贡献徽章
日期:2006-04-17 13:46:34
28#
 楼主| 发表于 2005-3-7 13:13 | 只看该作者
多谢各位,SQLNET.EXPIRE_TIME=0 这方法可行,目前还没发现会对其它应用造成负面影响

使用道具 举报

回复
论坛徽章:
1
会员2006贡献徽章
日期:2006-04-17 13:46:34
29#
 楼主| 发表于 2005-3-7 17:17 | 只看该作者
测试了一天,设置SQLNET.EXPIRE_TIME=0  
系统好象并不会在断线后立刻把session kill掉,总要隔几秒或几十秒几分种不等

使用道具 举报

回复
论坛徽章:
168
马上加薪
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-01-04 11:49:54蜘蛛蛋
日期:2011-12-05 16:08:56ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41设计板块每日发贴之星
日期:2011-07-22 01:01:02ITPUB官方微博粉丝徽章
日期:2011-06-30 12:30:16管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:33
30#
发表于 2005-3-7 18:11 | 只看该作者
最初由 weijsh 发布
[B]测试了一天,设置SQLNET.EXPIRE_TIME=0  
系统好象并不会在断线后立刻把session kill掉,总要隔几秒或几十秒几分种不等 [/B]


这个除了跟oracle有关之外跟os应该也有点关系.
只是猜测......

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表