- 论坛徽章:
- 7
|
以前都用sp_identity来修复那个identity gap问题的,其实质就是用dbcc object_atts来重设oam页内identity值的。
今天闲来无事,在ASE15.0.2 ESD#5上试了一下没想到真的不能用了。
- 1. 我先create table identtb(id int identity,value int)
- 2. 然后用dbcc object_atts(identtb,0,get)查到
- 1> dbcc object_atts(identtb,0,get)
- 2> go
- 1616c0138 ( 0): 00000000 0000000f 00000000 00000000 ................
- 1616c0148 ( 16):
- object_atts:get: return value=1 for ptnid 92524332
- DBCC execution completed. If DBCC printed error messages, contact a user with
- System Administrator (SA) role.
- 3. 这个时候我insert进去几条数据-- insert identtb values(1),insert identtb values(2)…
- 4. 我再用dbcc object_atts(identtb,0,get)查结果还是:
- 1> dbcc object_atts(identtb,0,get)
- 2> go
- 1616c0138 ( 0): 00000000 0000000f 00000000 00000000 ................
- 1616c0148 ( 16):
- object_atts:get: return value=1 for ptnid 92524332
- DBCC execution completed. If DBCC printed error messages, contact a user with
- System Administrator (SA) role.
- 一点变化也没有
- 5. 我不死心,于是手工造了一个identity gap,我把id>2 and id<10的纪录都删掉了,这个时候查dbcc object_atts(identtb,0,get)还是全0
- 6. 只好用dbcc object_atts(identtb,0,put,0x00000000000000030000000000000000)来重设那个identity起始值,并且迅速shutdown with nowait
- 7. 重起好之后,用dbcc object_atts(identtb,0,get)查到这个identity值确实仍是0x00000000000000030000000000000000
- 8. 于是我再insert新值进去 insert identtb values(10),insert identtb(11)可是这时候我很吃惊地发现这一条纪录已经变成了--
- id value
- ----------- -----------
- 1 1
- 2 2
- 5000002 10
- 5000003 11
- 9. 于是赶紧又用dbcc object_atts(identtb,0,put,0x00000000000000000000000000000000)改回去立刻shutdown with nowait并重起,于是更吃惊的事情发生了,
- 10. 在重起后,发现又跳了一个identity gap,id的起始值从10000000开始了,于是我重复了几次,发现无论put什么值,都是给我跳一个gap,最后变成了--
- id value
- ----------- -----------
- 1 1
- 2 2
- 8 8
- 9 9
- 3 5
- 4 6
- 5 7
- 5000002 10
- 5000003 11
- 10000003 12
- 15000004 13
- 20000005 14
复制代码 我想大概是因为ase15的oam页的结构有变化吧,请问各位可有发现同样的事情? |
|