数据库运维之--手工杀掉一个会话
来源:互联网 发布:网络人netman 编辑:程序博客网 时间:2024/05/17 01:06
如何手工杀掉一个oracle会话
Sometimes it may necessary for the DBA to terminate certain user sessions.A user session can be terminated by using the alter system command .The SID and SERIAL# from the v$session view are required to kill the session.
when you kill a session,first the session is terminated by Oracle to preventthe session from executing any more SQL statements.If any SQL statement is in progress when the session is terminated ,the statement is terminated and all changes are rolled back.The locks and other resources used by the session are also release.
SESSION A
SQL> l
1 select username,sid,serial#,status
2 from v$session
3* where username='CX'
SQL> run
1 select username,sid,serial#,status
2 from v$session
3* where username='CX'
USERNAME SID SERIAL# STATUS
------------------------------ ---------- ---------- --------
CX 1606 568 ACTIVE
SQL>
SQL>
SQL>
SQL> select count(*) from tabs;
select count(*) from tabs
*
ERROR at line 1:
ORA-00028: your session has been killed
SESSION B
$
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jan 21 17:22:09 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL>
SQL>
SQL>
SQL> alter system kill session '1606,568';
System altered.
SQL>
|||||||||||||||||||||||||||||||||||
If you want the user to complete the current transaction and then terminate their session,you can use the disconnect session option of the ALTER SYSTEM command.
If the session has no pending or active transactions ,this command has the same effect as kill session.Here is an example:
Alter system disconnect session '9,3' POST_TRANSATION;
You can also use the IMMEDIATE clause with the KILL SESSION or DISCONNECT
SESSION to roll back ongoing transactions,release all session locks,recover
the entire session state,and return control to you immediately.Here are
some examples.
Alter system disconnect session '9,3' immediate;
Alter system kill session '9,3' immediate;
- 数据库运维之--手工杀掉一个会话
- oracle 数据库12c 一个pdb进行delete操作,commit失败导致被锁,需要把会话杀掉
- 终止会话,杀掉进程
- 杀掉某个会话
- oracle 手工断开会话
- ORACLE数据库杀掉会话进程的三种方式及案例分析
- 手工杀掉传奇终结者变种
- 保证oracle数据库只有一个会话(1)
- 如何杀掉greenplum、postgresql的会话进程
- 如何杀掉(kill)Oracle中的会话(Session)
- 杀掉(kill)Oracle中会话或死锁
- 如何杀掉oracle中的会话session
- 如何杀掉(kill)Oracle中的会话(Session)
- 杀掉数据库用户进程
- 数据库笔记系列之SQL会话
- 手工杀掉双线程、感染所有EXE文件病毒
- OCM备考 一、Server config 之手工创建数据库
- 手工创建数据库(新建一个实例,在同一个数据库上跑两个实例)
- 从技术问题变成RPWT
- MFC用COM方式调用ActiveX类型的DLL
- Effective Java 学习笔记(13)
- declare-styleable:自定义控件的属性
- 小型办公组网方案
- 数据库运维之--手工杀掉一个会话
- PL/SQL Developer 或Toad 不安装Oracle 客户端连接数据库
- 多核的网络游戏服务器开发 之 网络库(二)
- iis日志分析
- 利用 Gstreamer 写简单的MP3播放器
- Rational Rose2003 破解汉化
- 关于异常,,try--catch 简单应用,
- 用gstreamer sdl做了一个简陋的mp3播放器
- The ranger Lor'themar Theron