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
解锁语句
alter system kill session 'sid,serial#'
--查询锁表的sid,serial
select b.username,b.sid,b.serial#,logon_time from vsession b where a.session_id = b.sid order by b.logon_time;
--解表
alter system kill session'sid,serial';
MySQL
查看是否有锁表SQL:(注意大小写)
show OPEN TABLES where In_use > 0;
杀掉锁表进程解锁表:
show processlist; (查看锁表的进程-得到PROCESSID)
kill pid;