我今天是第二次亲自测试. 表: create table test (id int) insert into test values(1) 开一个进程:运行 begin tran select * from test with (rowlock,holdlock) where id=1 再开一个进程运行 sp_lock 怎么会看不见呢?
我也运行这个测试: create table test (id int) insert into test values(1) 此时sp_lock spid dbid ObjId IndId Type Resource Mode Status ------ ------ ----------- ------ ---- ---------------- -------- ------ 1 1 0 0 DB S GRANT 6 1 0 0 DB S GRANT 7 1 0 0 DB S GRANT 7 2 0 0 DB S GRANT 7 1 117575457 0 TAB IS GRANT 8 5 0 0 DB S GRANT 然后再开一个进程 begin tran select * from test with (rowlock,holdlock) where id =1 再开一个进程 sp_lock 得到如下:spid dbid ObjId IndId Type Resource Mode Status ------ ------ ----------- ------ ---- ---------------- -------- ------ 1 1 0 0 DB S GRANT 6 1 0 0 DB S GRANT 7 1 0 0 DB S GRANT 7 2 0 0 DB S GRANT 7 1 117575457 0 TAB IS GRANT 8 5 0 0 DB S GRANT 8 5 933578364 0 TAB S GRANT 请问是怎么一会事?
请问GUO和GUOSTONG这是为什么?
表:
create table test (id int)
insert into test values(1)
开一个进程:运行
begin tran
select * from test with (rowlock,holdlock) where id=1
再开一个进程运行
sp_lock
怎么会看不见呢?
create table test (id int)
insert into test values(1)
此时sp_lock
spid dbid ObjId IndId Type Resource Mode Status
------ ------ ----------- ------ ---- ---------------- -------- ------
1 1 0 0 DB S GRANT
6 1 0 0 DB S GRANT
7 1 0 0 DB S GRANT
7 2 0 0 DB S GRANT
7 1 117575457 0 TAB IS GRANT
8 5 0 0 DB S GRANT
然后再开一个进程
begin tran
select * from test with (rowlock,holdlock) where id =1
再开一个进程
sp_lock
得到如下:spid dbid ObjId IndId Type Resource Mode Status
------ ------ ----------- ------ ---- ---------------- -------- ------
1 1 0 0 DB S GRANT
6 1 0 0 DB S GRANT
7 1 0 0 DB S GRANT
7 2 0 0 DB S GRANT
7 1 117575457 0 TAB IS GRANT
8 5 0 0 DB S GRANT
8 5 933578364 0 TAB S GRANT
请问是怎么一会事?
我上次的确看到系统使用的是行锁,有相应的rowid但当时我感觉这没有通用性,也就没说.
基础知识不过关呀,以后多向你学习!你的e_mail是不是[email protected]呀?