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应用 ...
随机推荐
- 【转】重载(overload),覆盖(override),隐藏(hide)的区别
原文网址:http://www.cppblog.com/zgysx/archive/2007/03/12/19662.html 写正题之前,先给出几个关键字的中英文对照,重载(overload),覆盖 ...
- oracle 绑定变量
“绑定变量”这个词也许对于某些人来说看以来陌生,其实我们在很早的时候就已经开始运用它了. 在java中使用的PrepareStatement对象,大家一定会说这不是将sql语句做预编译操作嘛,被封装的 ...
- ssh 登录出现的几种错误以及解决办法
首先.确保server端的ssh服务是开的(service shhd start) 然后在client端输入: ssh usrname@serverip (远程登录) scp filename usr ...
- A. Difference Row
A. Difference Row time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Eclipse插件Subclipse各版本插件下载地址以及与Subverison的对应关系
Subclipse 1.4.x includes and requires Subversion 1.5.x client features and working copy format. Subc ...
- Ubuntu安装secureCRT
在使用secureCRT前确保主机的ssh服务是启动状态. 一.下载secureCRT包 site: https://www.vandyke.com/download/securecrt/downl ...
- JavaScript高级程序设计46.pdf
鼠标按钮 只有在主鼠标按钮被单击(或键盘回车键被按下)是才会触发click事件,对于mousedown和mouseup事件,其event对象存在一个button属性,表示按下或者释放按钮.DOM的bu ...
- memcpy和strlen函数的实现
#include <stdio.h> #include <stdlib.h> //malloc()函数 typedef unsigned int size_t; size_t ...
- 探索AutoLayout的本质和解决一些问题
最近频繁使用AutoLayout,记录下自己的一些发现和问题的解决(不是教程) 1.简介 Auto Layout 是苹果在 iOS 6中新引入的布局方式,旨在解决不同尺寸屏幕的适配问题. 屏幕适配工作 ...
- TCP/UDP是如何传输的?
一.网络模型: OSI参考模型 TCP/IP参考模型 二.网络通讯要素 IP地址: 网络中设备的标识 不易记忆,可用主机名 本机回环地址:127.0.0.1 主机名: localhost 端口号: 用 ...