全部博文(136)
分类: Oracle
2008-04-14 15:06:17
-- session1 SQL> conn test/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 11 SQL> select sid, serial# from v$session where sid=11; SID SERIAL# ---------- ---------- 11 141 SQL> |
-- session2 SQL> conn test/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 17 SQL> select sid, status from v$session where sid =11; SID STATUS
SQL> alter system kill session '11, 141'; 系统已更改。 SQL> select sid, status from v$session where sid =11; SID STATUS SQL> |
-- session1 SQL> select sid, serial# from v$session where sid=11; select sid, serial# from v$session where sid=11 * ERROR 位于第 1 行: ORA-00028: 您的会话己被删去 SQL> |
-- session2 SQL> select sid, status from v$session where sid =11; 未选定行 SQL> |
-- session1 C:\Documents and Settings\YUECHAOTIAN>set oracle_sid=ora2 C:\Documents and Settings\YUECHAOTIAN>sqlplus SQL*Plus: Release Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 请输入用户名: yuechaotian/test 连接到: Oracle9i With the Partitioning, OLAP and Oracle Data Mining options JServer Release SQL> select distinct sid from v$mystat; SID ---------- 11 SQL> |
-- session2 SQL> conn yuechaotian/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 17 SQL> host Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp. C:\Documents and Settings\YUECHAOTIAN>orakill Usage: orakill sid thread where sid = the Oracle instance to target thread = the thread id of the thread to kill The thread id should be retrieved from the spid column of a query such as: select spid, osuser, s.program from v$process p, v$session s where p.addr=s.paddr C:\Documents and Settings\YUECHAOTIAN>exit SQL> set pagesize 100 SQL> set linesize 1000 SQL> select s.sid, spid, osuser, s.program from 2 v$process p, v$session s where p.addr=s.paddr; SID SPID OSUSER PROGRAM ---- ------- ------------------- ----------- 1 3636 SYSTEM ORACLE.EXE 2 3444 SYSTEM ORACLE.EXE 3 3496 SYSTEM ORACLE.EXE 4 3100 SYSTEM ORACLE.EXE 5 2460 SYSTEM ORACLE.EXE 6 296 SYSTEM ORACLE.EXE 7 696 SYSTEM ORACLE.EXE 8 1820 SYSTEM ORACLE.EXE 9 2912 SYSTEM ORACLE.EXE 10 3212 SYSTEM ORACLE.EXE 11 3412 YUECHAOTIAN\tianyc sqlplus.exe 17 3536 YUECHAOTIAN\tianyc sqlplus.exe
已选择12行。
SQL> select instance_name from v$instance; INSTANCE_NAME
SQL> host Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp. C:\Documents and Settings\YUECHAOTIAN>orakill ora2 3412 Kill of thread id 3412 in instance ora2 successfully signalled. C:\Documents and Settings\YUECHAOTIAN>exit SQL> select sid from v$session where sid=11; 未选定行 SQL> |
SQL> conn test/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 18 SQL> |
SQL> conn test/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 16 SQL> |
SQL> conn test/test 已连接。 SQL> select distinct sid from v$mystat; SID ---------- 11 SQL> select sid, serial#, status, paddr from v$session where sid in(16, 18); SID SERIAL# STATUS PADDR SQL> select ADDR, PID, SPID, USERNAME, SERIAL#, TERMINAL 2 from v$process where addr in('681E82BC','681E7EFC'); ADDR PID SPID USERNAME SERIAL# TERMINAL -------- ---- ------ --------- ---------- ----------- 681E7EFC 17 324 SYSTEM 2 YUECHAOTIAN 681E82BC 18 3120 SYSTEM 1 YUECHAOTIAN SQL> alter system kill session '16,18'; 系统已更改。 SQL> alter system kill session '18,49'; 系统已更改。 SQL> select sid, serial#, status, paddr from v$session where sid in(16, 18); SID SERIAL# STATUS PADDR ---------- ---------- -------- -------- 16 18 KILLED 682071D0 18 49 KILLED 682071D0 SQL> select ADDR, PID, SPID, USERNAME, SERIAL#, TERMINAL 2 from v$process where addr in('681E82BC','681E7EFC'); ADDR PID SPID USERNAME SERIAL# TERMINAL -------- ------- ------- --------- ---------- ----------- 681E7EFC 17 324 SYSTEM 2 YUECHAOTIAN 681E82BC 18 3120 SYSTEM 1 YUECHAOTIAN SQL> |
SQL> select addr from v$process where pid <> 1 2 minus 3 select paddr from v$session; ADDR -------- 681E64BC 681E687C SQL> |