查询并杀掉锁

SELECT  S.SID SESSION_ID, S.USERNAME, 
DECODE(LMODE, 0, 'None', 1, 'Null', 2, 'Row-S (SS)', 3, 'Row-X (SX)',  4, 'Share', 5, 'S/Row-X (SSX)',  6, 'Exclusive', TO_CHAR(LMODE)) MODE_HELD, 
DECODE(REQUEST, 0, 'None', 1, 'Null', 2, 'Row-S (SS)', 3, 'Row-X (SX)', 4, 'Share', 5, 'S/Row-X (SSX)', 6, 'Exclusive', TO_CHAR(REQUEST)) MODE_REQUESTED, 
O.OWNER||'.'||O.OBJECT_NAME||' ('||O.OBJECT_TYPE||')', S.TYPE LOCK_TYPE, L.ID1 LOCK_ID1, L.ID2 LOCK_ID2 
FROM V$LOCK L, SYS.DBA_OBJECTS O, V$SESSION S 
WHERE L.SID = S.SID AND  L.ID1 = O.OBJECT_ID
and s.USERNAME='HSINFO'
select * from v$locked_object;
select * from v$session where sid in(151,184,275,292)
alter system kill session '184,3171';
alter system kill session '275,1663';
alter system kill session '292,7498';

select * from v$process where serial# in(3171,1663,58422,7498)

select pro.spid from v$session ses,v$process pro 
where ses.sid in(278,279) and ses.paddr=pro.ADDR
eg
进程号 2000
ps -ef |grep 2000应该可以看到两条记录
kill -9 2000执行完之后
ps -ef |grep 2000应该就只有一条记录了
 

你可能感兴趣的:(查询)