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应用 ...
随机推荐
- TeamViewer 远程时出现:现在无法捕捉画面。这可能是由于恰的用户切换或远程桌面会话断开、最小化
关掉远程访问主机的TeamViewer ,再重新打开软件
- Silverlight的ComboBox 的绑定和取值
Silverlight的ComboBox与winform中的ComboBox存在类似的地方,但也有不同之处,本章包含以下内容: 一.ComboBox 如何添加和绑定数据. 二.ComboBox 如何添 ...
- Datable 详解,及用法
一.DataSet.DataTable.DataRow.DataColumn 1] 在DataSet中添加DataTable DataSet.Tables.Add(DataTable) 实例: Dat ...
- Branch management
Branch management */--> pre { background-color: #2f4f4f;line-height: 1.6; FONT: 10.5pt Consola,&q ...
- windows上zend server安装 报The server encountered an internal error or misconfiguration and was unable to complete your request -解决方法 摘自网络
windows上zend server安装完成后报如下错误: Internal Server Error The server encountered an internal error or m ...
- Android NDK开发Crash错误定位[转]
使用 ndk-stack 的时候需要你的 lib 编译为 debug版的,通常需要下面的修改: 1. 修改 android.mk,增加,为 LOCAL_CFLAGS 增加 -g 选项 2. 修改 ap ...
- head frist 设计模式学习之 JVM中的博物馆奇妙夜(观察者模式)
博物馆奇妙夜! 博物馆奇妙夜!博物馆奇妙夜!重说三!!!JVM看了<博物馆奇妙夜>电影之后,决定在自己家里开一个博物馆!毕竟需要什么new一下就好,博物馆很快就开起来了,并且任命你为馆长( ...
- InetAddress Example program in Java
The InetAddress class has no visible constructors. To create an InetAddress object, you have to use ...
- Mockito测试
Mockito 一 mockito基本概念 Mock测试是单元测试的重要方法之一,而Mockito作为一个流行的Mock框架,简单易学,且有非常简洁的API,测试代码的可读性很高. Mock测试就是在 ...
- 在CentOS搭建Git服务器 转
在CentOS搭建Git服务器 来自 :http://www.jianshu.com/p/69ea5ded3ede 前言 我们可以GitHub发布一些开源代码的公共仓库,但对于私密仓库就需要收费了.公 ...