我用范围左函数制作了一个分区表。然后我将一些行插入到一个分区中。结果:
select partition_id, partition_number, rows from sys.partitions where object_id = object_id('ptest')
结果:
partition_id partition_number rows
72057594464436224 1 8000
72057594464501760 2 0
72057594464567296 3 0
72057594464632832 4 0
然后我更新该表的一些行并查询 sys.dm_tran_locks,然后我在 partition4 上找到一些 RID 锁,如下所示:
select * from sys.dm_tran_locks where resource_type = 'RID'
结果如下:
Resource_type Resource_description
RID 3:13:192
RID 1:153496:257
当我使用dbcc page验证页面 3:13 包含的内容时,我什么也得不到:
dbcc traceon(3604)
dbcc page(db, 3, 13, 3)
结果如下:
PAGE: (3:13)
BUFFER:
BUF @0x03E98BCC
bpage = 0x5A622000 bhash = 0x00000000 bpageno = (3:13)
bdbid = 11 breferences = 0 bUse1 = 38298
bstat = 0x1c0010b blog = 0x79797979 bnext = 0x00000000
PAGE HEADER:
Page @0x5A622000
m_pageId = (3:13) m_headerVersion = 1 m_type = 1
m_typeFlagBits = 0x4 m_level = 0 m_flagBits = 0xa008
m_objId (AllocUnitId.idObj) = 6973 m_indexId (AllocUnitId.idInd) = 256
Metadata: AllocUnitId = 72057594494910464
Metadata: PartitionId = 72057594464501760 Metadata: IndexId = 0
Metadata: ObjectId = 1967398128 m_prevPage = (0:0) m_nextPage = (0:0)
pminlen = 12 m_slotCnt = 1 m_freeCnt = 8094
m_freeData = 5867 m_reservedCnt = 0 m_lsn = (25294:376:199)
m_xactReserved = 0 m_xdesId = (0:0) m_ghostRecCnt = 0
m_tornBits = -252731581
Allocation Status
GAM (3:2) = ALLOCATED SGAM (3:3) = ALLOCATED
PFS (3:1) = 0x60 MIXED_EXT ALLOCATED 0_PCT_FULL DIFF (3:6) = CHANGED
ML (3:7) = NOT MIN_LOGGED
因此,dbcc 页面确认页面 3:13 中没有任何内容。我的问题来了,为什么文件 3:13 上存在 RID 锁而那里什么都不存在?