alter system disconnect/kill session 'sid,serial#';
alter system disconnect 'sid,serial#';
1.session 1
SQL> conn yxy
Enter password:
Connected.
SQL> select * from t;
NUM
----------
1
SQL> update t set num=2 where num=1;
1 row updated.
2.session 2
SQL> select sid,serial#,username from v$session where type='USER';
SID SERIAL# USERNAME
---------- ---------- ------------------------------
10 1
11 1
15 21625 SYS
20 9893 YXY
SQL> select a.sid,a.serial#,a.username,b.spid from v$session a,v$process b where a.paddr=b.addr and a.sid=20;
SID SERIAL# USERNAME SPID
---------- ---------- ------------------------------ ------------
20 9907 YXY 27596
SQL> alter system disconnect session '20,9907' immediate;
System altered.
SQL> host
[oracle@restore ~]$ ps -ef | grep 27596
oracle 27596 27594 0 20:01:30 ? 0:00 oracleoramdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 27693 27690 0 20:06:38 pts/ta 0:00 grep 27596
3.session 1
SQL> r
1* update t set num=2 where num=1
update t set num=2 where num=1
*
ERROR at line 1:
ORA-00028: your session has been killed
SQL> exit
[oracle@restore ~]$
4.session 2
[oracle@restore ~]$ ps -ef | grep 27596
oracle 27697 27690 0 20:06:47 pts/ta 0:00 grep 27596
[oracle@restore ~]$ ps -ef | grep 27596
[oracle@restore ~]$ ps -ef | grep 27596
oracle 27771 27690 1 20:06:51 pts/ta 0:00 grep 27596
alter system kill session 'sid,serial#';
1.session 1
SQL> update t set num=2 where num=1;
1 row updated.
2.session 2
SQL> select a.sid,a.serial#,a.username,b.spid from v$session a,v$process b where a.paddr=b.addr and a.sid=20;
SID SERIAL# USERNAME SPID
---------- ---------- ------------------------------ ------------
20 9939 YXY 27887
SQL> alter system kill session '20,9939' immediate;
System altered.
SQL> host
[oracle@restore ~]$ ps -ef | grep 27887
oracle 27974 27972 0 20:19:13 pts/ta 0:00 grep 27887
oracle 27887 27871 0 20:15:54 ? 0:00 oracleoramdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
[oracle@restore ~]$ ps -ef | grep 27887
oracle 27887 27871 0 20:15:54 ? 0:00 oracleoramdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 27976 27972 0 20:19:24 pts/ta 0:00 grep 27887
2.session 1
SQL> r
1* update t set num=2 where num=1
update t set num=2 where num=1
*
ERROR at line 1:
ORA-00028: your session has been killed
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.5.0 - Production
[oracle@restore ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.5.0 - Production on Sat Mar 17 20:20:02 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn yxy
Enter password:
Connected.
SQL> select * from t;
NUM
----------
1
3.session 2
[oracle@restore ~]$ ps -ef | grep 27887
oracle 27979 27972 0 20:19:41 pts/ta 0:00 grep 27887
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7364032/viewspace-17458/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 獲取本session的sid和serial#Session
- [20180918]disconnect session和kill session的區別.txtSession
- mysql批次kill sessionMySqlSession
- 無腦批量kill sessionSession
- ALTER SYSTEM FLUSH BUFFER_POOL
- 2.7.6.2.1 ALTER SYSTEM SET語句中的SCOPE子句
- alter system set event和set events的區別
- [20231023]備庫與alter system flush buffer_cache.txt
- OB運維 | 連線 kill 中的 session_id運維Session
- alter system set ... scope=... 中的scope的含義是什麼?
- ORACLE之手動註冊監聽listener。alter system set local_listener="XXX"Oracle
- kinect2.0 Self-Learning (1) - recycling disconnect (solved)
- SQL__ALTERSQL
- MySQL ALTER命令MySql
- [Bash] Kill command
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- mysql加快alter操作MySql
- 【linux】kill命令模板Linux
- Oracle不同版本檢視資料庫session/system級別設定了哪些eventsOracle資料庫Session
- alter database disable thread 2Databasethread
- mysql的ALTER TABLE命令MySql
- alter table set unused column
- sqlserver kill long time lockSQLServer
- 程式命令ps/top/kill
- 精通 Linux 的 “kill” 命令Linux
- alter table move與shrink space
- alter table nologging /*+APPEND PARALLEL(n)*/APPParallel
- alter table drop unused columns checkpoint
- SID“2017年顯示周”盛大來襲!
- linux之kill命令詳解Linux
- kill與pkill的區別
- kill 已啟動的程式
- kill 指令的執行原理
- linux 檢視程式 kill程式Linux
- 如何獲取 alter 裡面的字串?字串
- 開心檔之MySQL ALTER命令MySql
- 使用pt-kill根據一定的規則來kill連線的方法
- System
- SID是什麼?用於什麼場景