KILL SESSION 相关

http://jaffardba.blogspot.com/2010/02/why-alter-system-kill-session-immediate.html

 

        最近在使用ALTER SYSTEM KILL SESSION 'sid,serial#'; kill掉一个inactive的session时,marked for kill,随后发现很久都没有从v$session中清理掉。然后查找到对应的os上的进程,进程状态还是很正常的,发送了kill -3,就清理掉了(当然kill -9肯定ok啦)。

        既然遇到了,那就研究下~

Why alter system kill session IMMEDIATE is good

I am pretty sure that many of us come across of situations when a killed session by 'alter system kill session' command did put the session in 'KILLED' status and never released the session  for a long time on the database. It could be due to the fact that the session would be rolling back the ongoing transaction.
Whenever we are in such situation, we generally try to find out the OS pid (on UNIX OS) associated with the killed session (which is a bit difficult task, as the killed session paddr in v$session changes while the addr corresponding value in v$process does not), and kill the associated OS process with 'kill -9' command on the OS level.
I have found the IMMEDIATE option with the 'alter system kill session' is more useful as it writes the following information in the alert.log file after killing the session and also try to finish the things at the earliest possible to close the session from the database:

Wed Feb 10 11:02:39 2010 
Immediate Kill Session#: 515, Serial#: 36366
Immediate Kill Session: sess: c0000001be20d9f0  OS pid: 14686

As you see, it writes the time stamp when the session was killed, and also gives the associated OS pid of the killed session in the alert.log. As per Oracle documentation, ' Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately.'

Syntax:

alter system kill session 'sid,serial#' IMMEDIATE;

Regards,

Jaffar

 

 

Hi, Jaffar.

Pls, note that it is not case in 9i.

Regards

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23650854/viewspace-688866/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23650854/viewspace-688866/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值