日期:2014-05-17 浏览次数:20472 次
-- 建测试表
create table 表(列 varchar(10))
insert into 表(列) values('bb')
-- 查看锁过程
dbcc traceon(3604,1200,1211,-1)
update 表 set 列='aa' where 列='bb'
dbcc traceoff(3604,1200,1211,-1)
/*
Process 51 acquiring IX lock on OBJECT: 9:1605580758:0 (class bit2000000 ref1) result: OK
Process 51 acquiring S lock on DATABASE: 9 [PLANGUIDE] (class bit0 ref1) result: OK
Process 51 acquiring S lock on DATABASE: 9 [PLANGUIDE] (class bit0 ref1) result: OK
Process 51 acquiring Sch-S lock on OBJECT: 9:1621580815:0 (class bit0 ref1) result: OK
Process 51 acquiring Sch-S lock on METADATA: database_id = 9 INDEXSTATS(object_id = 1621580815, index_id or stats_id = 0) (class bit0 ref1) result: OK
Process 51 acquiring Sch-S lock on METADATA: database_id = 9 INDEXSTATS(object_id = 1621580815, index_id or stats_id = 0) (class bit0 ref1) result: OK
Process 51 releasing lock reference on METADATA: database_id = 9 INDEXSTATS(object_id = 1621580815, index_id or stats_id = 0)
Process 51 acquiring X lock on OBJECT: 9:1621580815:0 [UPDSTATS] (class bit0 ref1) result: OK
Process 51 releasing lock on OBJECT: 9:1621580815:0 [UPDSTATS]
Process 51 acquiring Sch-S lock on METADATA: database_id = 9 INDEXSTATS(object_id = 1621580815, index_id or stats_id = 2) (class bit0 ref1) result: OK
Process 51 acquiring Sch-S lock on METADATA: database_id = 9 STATS(object_id = 1621580815, stats_id = 2) (class bit0 ref1) result: OK
Process 51 acquiring S lock on KEY: 9:281474980642816 (54b57c18e177) (class bit0 ref1) result: OK
Process 51 releasing lock on METADATA