ITPub博客

首页 > 应用开发 > IT综合 > RAC中删除特定instance的session

RAC中删除特定instance的session

原创 IT综合 作者:tolilong 时间:2013-10-25 08:41:58 0 删除 编辑
单实例session可以直接通过v$session和v$locked_object两个视图就可以kill。[@more@]

select distinct 'ALTER SYSTEM KILL SESSION '''||b.sid||', '||b.serial#||''';'
from v$locked_object a,v$session b where a.session_id=b.sid


但是这个不能删除RAC中session


alter system kill session 的语法:

The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources. To use this clause, your instance must have the database open. Your session and the session to be terminated must be on the same instance unless you specify integer3.You must identify the session with the following values from the V$SESSION view:
alter system KILL SESSION 'integer1, integer2[, @integer3]' [IMMEDIATE]
For integer1, specify the value of the SID column.
For integer2, specify the value of the SERIAL# column.
For the optional integer3, specify the ID of the instance where the target session to be killed exists. You can find the instance ID by querying the GV$ tables.


RAC中kill session的脚本:

select distinct 'ALTER SYSTEM KILL SESSION '''||b.sid||', '||b.serial#||',@'||b.inst_id||''';'
from gv$locked_object a,gv$session b where a.session_id=b.sid and a.inst_id=b.inst_id


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

请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    1208664