select 'alter system kill session '''||sess.sid||','||sess.serial#||''';' bb,sess.sid,sess.serial#, lo.oracle_username,--登录账号lo.os_user_name,--登录电脑ao.object_name,--被锁表名lo.locked_mode --锁住级别from v$locked_object lo,dba_objects ao,v$session sess where ao.object_id=lo.object_id and lo.session_id=sess.sid;
查询锁表语句:
SELECT A.USERNAME,A.MACHINE,A.PROGRAM,A.SID,A.SERIAL#,A.STATUS,C.PIECE,C.SQL_TEXTFROM V$SESSION A, V$SQLTEXT CWHERE A.SID IN (SELECT DISTINCT T2.SIDFROM V$LOCKED_OBJECT T1, V$SESSION T2WHERE T1.SESSION_ID = T2.SID)AND A.SQL_ADDRESS = C.ADDRESS(+)ORDER BY C.PIECE;
1.oracle如何解决锁表_oracle_bunny_lhc-华为云开发者联盟
select object_name,s.sid,s.serial#,p.spid
from v$locked_object l,dba_objects o,v$session s,v$process p
where l.object_id=o.object_id and l.session_id=s.sid and s.paddr=p.addr;alter system kill session '408,60867'; --sid,serial#是上面查询出来的结果;