免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7976 | 回复: 2
打印 上一主题 下一主题

忽然发现ASE15里面的dbcc object_atts不好用了 [复制链接]

论坛徽章:
7
数据库技术版块每日发帖之星
日期:2015-08-09 06:20:00数据库技术版块每日发帖之星
日期:2015-11-03 06:20:00数据库技术版块每日发帖之星
日期:2016-02-20 06:20:00数据库技术版块每日发帖之星
日期:2016-07-13 06:20:00数据库技术版块每日发帖之星
日期:2016-07-31 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-18 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-04-19 16:00 |只看该作者 |倒序浏览
以前都用sp_identity来修复那个identity gap问题的,其实质就是用dbcc object_atts来重设oam页内identity值的。
今天闲来无事,在ASE15.0.2 ESD#5上试了一下没想到真的不能用了。

  1. 1.         我先create table identtb(id int identity,value int)
  2. 2.         然后用dbcc object_atts(identtb,0,get)查到
  3. 1> dbcc object_atts(identtb,0,get)
  4. 2> go

  5. 1616c0138 (     0):  00000000 0000000f 00000000 00000000  ................
  6. 1616c0148 (    16):
  7. object_atts:get: return value=1 for ptnid 92524332
  8. DBCC execution completed. If DBCC printed error messages, contact a user with
  9. System Administrator (SA) role.
  10. 3.         这个时候我insert进去几条数据-- insert identtb values(1),insert identtb values(2)…
  11. 4.         我再用dbcc object_atts(identtb,0,get)查结果还是:
  12. 1> dbcc object_atts(identtb,0,get)
  13. 2> go

  14. 1616c0138 (     0):  00000000 0000000f 00000000 00000000  ................
  15. 1616c0148 (    16):
  16. object_atts:get: return value=1 for ptnid 92524332
  17. DBCC execution completed. If DBCC printed error messages, contact a user with
  18. System Administrator (SA) role.
  19. 一点变化也没有
  20. 5. 我不死心,于是手工造了一个identity gap,我把id>2 and id<10的纪录都删掉了,这个时候查dbcc object_atts(identtb,0,get)还是全0
  21. 6.  只好用dbcc object_atts(identtb,0,put,0x00000000000000030000000000000000)来重设那个identity起始值,并且迅速shutdown with nowait
  22. 7.  重起好之后,用dbcc object_atts(identtb,0,get)查到这个identity值确实仍是0x00000000000000030000000000000000
  23. 8.  于是我再insert新值进去 insert identtb values(10),insert identtb(11)可是这时候我很吃惊地发现这一条纪录已经变成了--

  24.       id          value
  25. ----------- -----------
  26.           1           1
  27.           2           2
  28.     5000002          10
  29.     5000003          11


  30. 9. 于是赶紧又用dbcc object_atts(identtb,0,put,0x00000000000000000000000000000000)改回去立刻shutdown with nowait并重起,于是更吃惊的事情发生了,
  31. 10. 在重起后,发现又跳了一个identity gap,id的起始值从10000000开始了,于是我重复了几次,发现无论put什么值,都是给我跳一个gap,最后变成了--
  32. id          value
  33. ----------- -----------
  34.           1           1
  35.           2           2
  36.           8           8
  37.           9           9
  38.           3           5
  39.           4           6
  40.           5           7
  41.     5000002          10
  42.     5000003          11
  43.    10000003          12
  44.    15000004          13
  45.    20000005          14

复制代码
我想大概是因为ase15的oam页的结构有变化吧,请问各位可有发现同样的事情?

论坛徽章:
0
2 [报告]
发表于 2011-04-20 10:22 |只看该作者
这个函数没用过,但identity gap不是这样修复的,Rob的网站讲得很详细。
http://www.sypron.nl/2004Q2_IDgapsRevisited.pdf
http://www.sypron.nl/idgaps.html

论坛徽章:
7
数据库技术版块每日发帖之星
日期:2015-08-09 06:20:00数据库技术版块每日发帖之星
日期:2015-11-03 06:20:00数据库技术版块每日发帖之星
日期:2016-02-20 06:20:00数据库技术版块每日发帖之星
日期:2016-07-13 06:20:00数据库技术版块每日发帖之星
日期:2016-07-31 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-18 06:20:00
3 [报告]
发表于 2011-04-20 12:40 |只看该作者
请仔细看你发的这两个文档——里面都说了不对ASE15了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP