查看Oracle锁表命令

查看数据库都有哪些锁

select 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 * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;

 

根据sid查看具体的sql语句

select sql_text from v$session a,v$sqltext_with_newlines b
where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
and a.sid=#149 order by piece;

 

kill锁表事务

alter system kill session   '129,303′;

 

参考文章:http://www.anbob.com/?p=16

你可能感兴趣的:(oracle,sql,数据库,object,session,System)