首页 > 代码库 > 清理session的案例

清理session的案例

select distinct(sql_id),OPNAME,sid,SERIAL#  from v$session_longops where sofar != totalwork and time_remaining>0 and OPNAME =Sort Output;create table temp_longops as select distinct(sql_id),OPNAME,sid,SERIAL#  from v$session_longops where sofar != totalwork and time_remaining>0 and OPNAME =Sort Output;select SERIAL#,sid,state from v$session where sql_id in (select distinct(sql_id) from v$session_longops where sofar != totalwork and time_remaining>0 and OPNAME =Sort Output );select alter system kill session ‘‘(||sid,SERIAL#||)  from v$session_longops where sofar != totalwork and time_remaining>0 and OPNAME =Sort Output;select a.state from v$session a,temp_longops b where a.sql_id=b.sql_id;select alter system kill session ‘‘‘||sid||,||SERIAL#||‘‘‘; from temp_longops;alter system kill session 1265,27141;alter system kill session 354,7053;alter system kill session 807,17451;alter system kill session 1581,41715;alter system kill session 4893,23;alter system kill session 2483,12035;alter system kill session 2742,20461;alter system kill session 281,34515;alter system kill session 3925,14451;alter system kill session 2911,8695;alter system kill session 4221,14531;alter system kill session 787,36285;alter system kill session 4436,19227;alter system kill session 25,57755;alter system kill session 2105,31275;alter system kill session 451,16259;alter system kill session 3475,47561;alter system kill session 3078,35245;alter system kill session 3181,22695;alter system kill session 2036,49463;alter system kill session 621,25583;alter system kill session 2947,8127;alter system kill session 4986,24129;alter system kill session 954,37155;alter system kill session 1020,697;alter system kill session 1712,9505;alter system kill session 5312,61639;alter system kill session 432,29873;alter system kill session 4315,57623;alter system kill session 3879,46481;alter system kill session 4750,25347;alter system kill session 3722,59543;alter system kill session 617,5747;alter system kill session 690,9737;alter system kill session 4271,25631;alter system kill session 439,8431;alter system kill session 2744,28857;alter system kill session 3851,29623;alter system kill session 2171,61211;alter system kill session 4397,11519;alter system kill session 3250,61731;alter system kill session 562,14817;alter system kill session 1853,29163;alter system kill session 100,47653;alter system kill session 5179,27265;alter system kill session 1963,14933;alter system kill session 4348,50923;alter system kill session 1942,65383;alter system kill session 1319,9267;alter system kill session 1325,16861;alter system kill session 717,52975;alter system kill session 4975,9421;alter system kill session 2065,23281;       SID    SERIAL# ---------- ---------- alter system kill session 647,18473; alter system kill session 4089,60027; alter system kill session 1431,13079; alter system kill session 2917,54287; alter system kill session 2669,14137; alter system kill session 4122,28789; alter system kill session 808,61661; alter system kill session 1896,12117; alter system kill session 4601,4497;alter system kill session 3537,64227; alter system kill session 3892,27767; alter system kill session 2801,28557; select alter system kill session ‘‘‘||sid||,||SERIAL#||‘‘‘;  from v$session_longops where time_remaining>0 and OPNAME =Sort Output;select a.state from v$session a,v$session_longops b where b.time_remaining>0 and b.OPNAME =Sort Output and a.sql_id=b.sql_id;select distinct(sql_id),OPNAME,sid,SERIAL#  from gv$session_longops where time_remaining>0 and OPNAME =Sort Output;

清理session的案例