rac中 kull session会话脚本
方法:ALTER SYSTEM KILL SESSION '80, 6, @2'; --<= 80 sid,6 serial#,@2 inst_id
kill session 脚本如下:
select 'alter system kill session '''||a.sid||','||b.serial#||',@'||c.inst_id||''' immediate ;' from
gv$session a ,gv$session b, gv$session c
where a.username=b.username and c.sid=b.sid and a.serial#=c.serial#
and a.username='DOUDOU'; --<=username可以换成你想kill的用户
实验如下
环境:11.2.0.4 rac on redhat6.3
1.在2个不同的node登录2个doudou用户
[oracle@rac1 ~]$ sqlplus doudou/oracle
SQL*Plus: Release 11.2.0.4.0 Production on Sun Aug 24 16:33:54 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
DBA TEL MAIL
------------------------------ ---------------------- --------------------
oracle world of wenyu.he 18211103395 wenyu.he@bhaf.com.cn <= edit glogin.sql
DOUDOU@doudou1> <= doudou1 is rac1 instance
[oracle@rac2 ~]$ sqlplus doudou/oracle
SQL*Plus: Release 11.2.0.4.0 Production on Sun Aug 24 16:34:40 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
DBA TEL MAIL
------------------------------ ---------------------- --------------------
oracle world of wenyu.he 18211103395 wenyu.he@bhaf.com.cn
DOUDOU@doudou2> <= doudou2 is rac2 instance
2.使用脚本生成批量kill session的语句
SYS@doudou1> select 'alter system kill session '''||a.sid||','||b.serial#||',@'||c.inst_id||''' immediate ;' from
2 gv$session a ,gv$session b, gv$session c
3 where a.username=b.username and c.sid=b.sid and a.serial#=c.serial#
4 and a.username='DOUDOU';
'ALTERSYSTEMKILLSESSION'''||A.SID||','||B.SERIAL#||',@'||C.INST_ID||'''IMMEDIATE
--------------------------------------------------------------------------------
alter system kill session '63,93,@1' immediate ;
alter system kill session '57,33,@2' immediate ;
3.执行kill session
SYS@doudou1> alter system kill session '63,93,@1' immediate ;
System altered.
alert_doudou1.log如下:
Immediate Kill Session#: 63, Serial#: 93
Immediate Kill Session: sess: 0x763924c8 OS pid: 8806
--从日志来看,session已经被kill
SYS@doudou1> alter system kill session '57,33,@2' immediate ;
System altered.
alert_doudou2.log如下:
Immediate Kill Session#: 57, Serial#: 33
Immediate Kill Session: sess: 0x763a4a08 OS pid: 18221
--从日志来看,session已经被kill
4.验证session是否被kill掉
脚本继续执行一次查看结果
SYS@doudou1> select 'alter system kill session '''||a.sid||','||b.serial#||',@'||c.inst_id||''' immediate ;' from
2 gv$session a ,gv$session b, gv$session c
where a.username=b.username and c.sid=b.sid and a.serial#=c.serial#
3 4 and a.username='DOUDOU';
no rows selected
--从脚本输出结果表示session已经被kill
5.去节点实例看看当前session状态
DOUDOU@doudou1> select * from tab;
select * from tab
*
ERROR at line 1:
ORA-03135: connection lost contact
Process ID: 8806
Session ID: 63 Serial number: 93
DOUDOU@doudou2> select * from tab;
select * from tab
*
ERROR at line 1:
ORA-03135: connection lost contact
Process ID: 18221
Session ID: 57 Serial number: 33
--session 确实已经被kill
总结:
RAC中的管理方法会和单实例略有不同,多看官档。希望可以(稳、准、狠)的管理好我的“RAC群”
rac中 kull session会话脚本的更多相关文章
- PHP中的session会话创建打印释放销毁;
PHP Session PHP session 变量用于存储关于用户会话(session)的信息,或者更改用户会话(session)的设置.Session 变量存储单一用户的信息,并且对于应用程序中的 ...
- ASP.NET Core 中使用Session会话
添加Session Nuget包 更新Startup.cs文件 在ConfigureServices方法中添加如下代码 services.AddSession(options => { // S ...
- .NET WebAPI中使用Session使用
问题及其解决方案: 今天做项目的时候因为需要编写一个短信验证码的接口我需要在我的后台.net webapi中存入我随机生成的短信验证码方便与前端传递过来的数据对比,所以决定使用session做缓存.但 ...
- 分布式Tomcat session会话Sticky Sessions问题
分布式session会话Sticky Sessions - tomcat_baby的专栏 - CSDN博客https://blog.csdn.net/tomcat_baby/article/detai ...
- 关于web会话中的session过期时间的设置
关于web会话中的session过期时间的设置 1.操作系统: 步骤:开始——〉管理工具——〉Internet信息服务(IIS)管理器——〉网站——〉默认网站——〉右键“属性”——〉主目录——〉配置— ...
- {Django基础八之cookie和session}一 会话跟踪 二 cookie 三 django中操作cookie 四 session 五 django中操作session
Django基础八之cookie和session 本节目录 一 会话跟踪 二 cookie 三 django中操作cookie 四 session 五 django中操作session 六 xxx 七 ...
- JavaWeb中Session会话管理,理解Http无状态处理机制
注:图片如果损坏,点击文章链接:https://www.toutiao.com/i6512955067434271246/ 1.<Servlet简单实现开发部署过程> 2.<Serv ...
- 这里的*号实际表示就是RAC中所有实例都使用
您的位置: ITPUB个人空间 » cc59的个人空间 » 日志 发布新日志 我的日志我的足迹我的收藏 unix/linuxHA随笔backup&restoreperformance tuni ...
- ASP.NET中的Session怎么正确使用
Session对象用于存储从一个用户开始访问某个特定的aspx的页面起,到用户离开为止,特定的用户会话所需要的信息.用户在应用程序的页面切换时,Session对象的变量不会被清除. 对于一个Web应用 ...
随机推荐
- linux kernel API and google android compile guide
(1)linux kernel API website: http://docs.knobbits.org/local/linux-doc/html/regulator/index.html http ...
- WinDump使用方法
转自:http://blog.csdn.net/weiyuweizhi/article/details/4326174 在命令行下启动windump.exe 参数列表: -a ...
- 计数方法(扫描线):JLOI 2016 圆的异或并
Description 在平面直角坐标系中给定N个圆.已知这些圆两两没有交点,即两圆的关系只存在相离和包含.求这些圆的异或面 积并.异或面积并为:当一片区域在奇数个圆内则计算其面积,当一片区域在偶数个 ...
- 大型邮箱smtp服务器及端口 收集
各大型邮箱smtp服务器及端口收集: 新浪邮箱smtp服务器 外发服务器:smtp.vip.sina.com 收件服务器:pop3.vip.sina.com 新浪免费邮件 外发服务器:smtp.sin ...
- show drop down menu within/from action bar
show drop down menu within/from action bar */--> pre { background-color: #2f4f4f;line-height: 1.6 ...
- Binggo公开课 “CODEX创新体系”的实战演练-中关村创业大街
Binggo公开课 "CODEX创新体系"的实战演练-中关村创业大街 Binggo公开课 "CODEX创新体系"的实战演练
- 使用GruntJS链接与压缩多个JavaScript文件
使用GruntJS链接与压缩多个JavaScript文件 自己写了个简单的HTML5 Canvas的图表库,可以支持饼图,折线图,散点图,盒子图 柱状图,同时支持鼠标提示,绘制过程动画效果等.最终我想 ...
- AppiumLibrary
Strategy Example Description identifier Click Element|identifier=my_element Matches by @id or @name ...
- butterknife简化android开发
butterknife库非常不错的依赖注入库 使用1 使用2 http://jakewharton.github.io/butterknife/ maven引入 http://www.mvnrepo ...
- BMVC reading list
'Combining Local and Global Cues for Closed Contour Extraction' Vida Movahedi, James Elder 'FRIF: Fa ...