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应用 ...
随机推荐
- ecshop 模板与库文件lbi
转: 管理中心的"设置模板"其实就是把特定的[库项目]添加到模板中的[可编辑区域],或从[可编辑区域]中删除/修改某些[库项目],后台的"设置模板"只能对添加特 ...
- [C# 网络编程系列]专题五:TCP编程
转自:http://www.cnblogs.com/zhili/archive/2012/08/25/2656840.html 前言 前面专题的例子都是基于应用层上的HTTP协议的介绍, 现在本专题来 ...
- (转载)C++ const成员初始化问题
(转载)http://www.189works.com/article-45135-1.html Const成员如其它任何成员一样,简单考虑其出现在三个位置:全局作用域.普通函数内部.类里面. 下面请 ...
- FileZilla 425 Can't open data connection
FileZilla 425 Can't open data connection WIN 2008 SERVER+FileZilla FTP Server,FTP端口:2013 防火墙中已允许FTP ...
- log4net封装类 zz
封装说明: 1.使用静态方法调用即可写入日志. 2.在日志信息写入之前,定义委托处理日志信息,便于记录日志信息之前,显示给用户. 3.添加代码配置Log4net,避免应用程序总是携带配置文件.如果需要 ...
- Delphi-idHttp-JSON用法
从国外网站抄来的代码 Delphi source: http := TIdHttp.Create(nil);http.HandleRedirects := True;//允许头转向http.ReadT ...
- 点分治练习:不虚就是要AK
[题面] 不虚就是要AK(czyak.c/.cpp/.pas) 2s 128M czy很火.因为又有人说他虚了.为了证明他不虚,他决定要在这次比赛AK. 现在他正在和别人玩一个游戏:在一棵树上随机取两 ...
- BZOJP1003 [ZJOI2006]物流运输trans
BZOJP1003 [ZJOI2006]物流运输trans 1003: [ZJOI2006]物流运输trans Time Limit: 10 Sec Memory Limit: 162 MB Sub ...
- Android学习笔记1:Activity与View
推荐一系列优秀的Android开发源码 Activity是Android应用中负责与用户交互的组件. View组件是所有UI控件.容器控件的基类,View组件就是Android应用中用户实实在在看到的 ...
- javascrip中array使用
一.测试数组长度是使用arr.length;(注:使用delete不会修改数组的length属性) 二.数组方法 1.join() Array.join()方法将数组所有元素都转化为字符串连接在一起, ...