1、oracle查看锁表,并杀死进程解锁
SELECT S.SID S_ID,s.SERIAL#, 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;
2、找到对应的表状态是正在读写的(Row-X (SX)),kill对应的'sid,serial'
具体操作
alter system kill session '193,33054';
3、服务器强制杀进程
SELECT pro.spid
FROM v$session ses, v$process pro
WHERE ses.sid = 628
AND ses.paddr = pro.addr;
具体操作
kill -9 pro.spid 进程号
4、解锁Oracle用户
alter user 用户名 account unlock;
|