文档介绍:精选文档
5
数据库锁表与解锁
、 mysql
锁定表:L0CKTABLE3bl_name {READ| WRITE},[ tbl_name {READ| WRITE},…]
解锁表: UNL0CK TABLES
SELECT DISTINCT ID, , # V$DB_OBJECT_CACHE OC, V$OBJECT_DE PENDENCY OD, DBA_KGLLOCK W,
V$SESSION S,
V$PROCESS P
WHERE =
AND =
AND =
AND =
AND P. ADDR = ADDR
AND = UPP ER('drag_data_from_lcam');
Oracle的锁表与解锁
SELECT /*+ rule */ ,
decode( pe,'TM','TABLE LOCK',
精选文档
4
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
ner, name, ype,
,#, nal, ne,s. program,
FROM v$session s,v$lock l,dba_objects o
WHERE =
AND = (+)
AND is NOT Null
--kill session 语句 (说明:下面的50是查询结果中sid字段值,492是
serial#字段值)
alter system kill session'50,492'; (需要 dba 权限)
--以下几个为相关表
SELECT * FROM v$lock;
SELECT * FROM v$sqlarea;
SELECT * FROM v$sessio n;
SELECT * FROM v$p rocess ;
SELECT * FROM v$locked_object;
SELECT * FROM all_objects;
SELECT * FROM v$session_wait;
-- object名
SELECT on_id sid, #, , name,
name, ne, in al, name, on _time
FROM v$locked_object l, all_objects o, v$sessi on s
WHERE =
AND =