楼主: hqs4500

[精华] delayed block cleanout 与 ORA-1555的关系

[复制链接]
招聘 : 数据库管理员
论坛徽章:
21
授权会员
日期:2005-10-30 17:05:332012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:362012新春纪念徽章
日期:2012-02-13 15:11:36马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:11:36
31#
发表于 2004-10-13 17:47 | 只看该作者
想明确一个问题:

事务表中slot 被覆盖的次序是什么?
是否按照commit scn的从小到大的顺序?

使用道具 举报

回复
论坛徽章:
314
行业板块每日发贴之星
日期:2012-07-12 18:47:29双黄蛋
日期:2011-08-12 17:31:04咸鸭蛋
日期:2011-08-18 15:13:51迷宫蛋
日期:2011-08-18 16:58:25紫蛋头
日期:2011-08-31 10:57:28ITPUB十周年纪念徽章
日期:2011-09-27 16:30:47蜘蛛蛋
日期:2011-10-20 15:51:25迷宫蛋
日期:2011-10-29 11:12:59ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41鲜花蛋
日期:2011-11-09 20:33:30
32#
发表于 2004-10-13 18:11 | 只看该作者

再问:

事务已经提交了,transaction table slot 不被覆盖,而使用的 UNDO BLOCK先被覆盖。
有这种可能吗?

若可能,则此时即便想到UNDO BLOCK读前IMAGE,那也无数据可读了。这时应该出现
ORA-01555吧?

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
33#
发表于 2004-10-13 18:15 | 只看该作者

Re: 再问:

最初由 ZALBB 发布
[B]事务已经提交了,transaction table slot 不被覆盖,而使用的 UNDO BLOCK先被覆盖。
有这种可能吗?

若可能,则此时即便想到UNDO BLOCK读前IMAGE,那也无数据可读了。这时应该出现
ORA-01555吧? [/B]


是的,如果需要读before  image 自然有问题了

但有时是不需要 undo  block 的,仅仅需要slot 信息来表明不需要回退,如果这样,就不用产生1555了

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
34#
发表于 2004-10-13 18:16 | 只看该作者
最初由 grassbell 发布
[B]想明确一个问题:

事务表中slot 被覆盖的次序是什么?
是否按照commit scn的从小到大的顺序? [/B]



我记得测试过,是的

使用道具 举报

回复
论坛徽章:
314
行业板块每日发贴之星
日期:2012-07-12 18:47:29双黄蛋
日期:2011-08-12 17:31:04咸鸭蛋
日期:2011-08-18 15:13:51迷宫蛋
日期:2011-08-18 16:58:25紫蛋头
日期:2011-08-31 10:57:28ITPUB十周年纪念徽章
日期:2011-09-27 16:30:47蜘蛛蛋
日期:2011-10-20 15:51:25迷宫蛋
日期:2011-10-29 11:12:59ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41鲜花蛋
日期:2011-11-09 20:33:30
35#
发表于 2004-10-13 18:20 | 只看该作者

Re: Re: 再问:

最初由 biti_rainy 发布
[B]

是的,如果需要读before  image 自然有问题了

但有时是不需要 undo  block 的,仅仅需要slot 信息来表明不需要回退,如果这样,就不用产生1555了 [/B]


若不需要读UNDO BLOCK,就得保证DML的SCN 比 QUERY SCN小,
若大的话,就得读了。

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
36#
发表于 2004-10-13 20:17 | 只看该作者

Re: Re: Re: 再问:

最初由 ZALBB 发布
[B]

若不需要读UNDO BLOCK,就得保证DML的SCN 比 QUERY SCN小,
若大的话,就得读了。 [/B]


当然

使用道具 举报

回复
论坛徽章:
10
授权会员
日期:2005-10-30 17:05:332010年世界杯参赛球队:科特迪瓦
日期:2010-04-15 12:20:472010年世界杯参赛球队:智利
日期:2010-04-13 17:15:21生肖徽章2007版:蛇
日期:2009-09-24 13:54:11生肖徽章2007版:龙
日期:2009-09-22 13:56:012009日食纪念
日期:2009-07-22 09:30:00生肖徽章2007版:龙
日期:2009-02-10 13:45:15生肖徽章2007版:狗
日期:2009-02-03 13:53:34会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB十周年纪念徽章
日期:2011-11-01 16:20:28
37#
发表于 2005-2-1 17:13 | 只看该作者
再看一遍,我终于也明白了。

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
38#
发表于 2005-2-1 17:25 | 只看该作者

Re: 参考

最初由 biti_rainy 发布
[B]一致读的步骤:
    1. Read the Data Block.

2. Read the Row Header.

3. Check the Lock Byte to determine whether there's an ITL entry.

4. Read the ITL entry to determine the Transaction ID (Xid).

5. Read the Transaction Table using the Transaction ID. If the transaction has been committed and has a System Commit Number less than the query's System Change Number, update the status of the block (block cleanout) and start over at step 1.

6. Read the last undo block (Uba).

7. Compare the block transaction ID with the transaction table transaction ID. If the Transaction ID in the undo block doesn't equal the Transaction ID from the Transaction Table, then issue ORA-1555, Snapshot Too Old.

8. If the Transaction IDs are identical, make a copy of the data block in memory. Starting with the head undo entry, apply the changes to the copied data block.

9. If the tail undo entry (the actual first undo entry in the chain, or the last in the chain going backwards!) indicates another data block address, read the indicated undo block into memory and repeat steps 7 and 8 until the undo entries don't contain a value for the data block address.

10. When there's no "previous data block address," the transaction has been completely undone.

11. If the undo entry contains:

a. a pointer to a previous transaction undo block address, read the Transaction ID in the previous transaction undo block header and read the appropriate Transaction Table entry. Return to step 5.

b. an ITL record, restore the ITL record to the data block. Return to step 4. [/B]


这里有很多概念:ITL (interest table list),--应该是位于数据块头中的吧,记录在该块上事务活动(transaction slot)。
                              UBa(undo block address?)
尤其是几个transaction id,有些混淆,bi第七点就是这样的。另外9也不是很理解,10中的previous data block address 指的是什么?

多多指教。

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
39#
发表于 2005-2-3 09:43 | 只看该作者

Re: Re: Re: 参考

最初由 Kamus 发布
[B]


第9步,你可以把rollback的过程想象为一个链表,从一个undo block链到另一个undo block,直到the undo entries don't contain a value for the data block address,表示整个rollback的过程完毕了。

至于第10步,10. When there's no "previous data block address," the transaction has been completely undone. 我也没太理解他想表达的是什么意思?如果没有前镜像数据,那么就表示事务根本还没结束?这个怎么会放在第10步单独来说呢? [/B]



第十步实际上就是第九步描述的结尾,因为 transaction table 中记录的是一个事务的结束block地址。 而一个事务在block 使用扩展的过程中,总是下一个block会记录上一个block的地址,这样逆序的时候就直接找到上一个block。所以回滚的时候找到事务的最末尾一个block,然后回滚--完毕跳到上一个block(undo  block address也看起来是data block address)……


也就是说:
until the undo entries don't contain a value for the data block address 就是   there's no "previous data block address"




这是一个事务之间的undo,对于不同事务,则是根据ITL的前印象 递归……这个可参考

http://www.itpub.net/showthread. ... 849&pagenumber=

使用道具 举报

回复
论坛徽章:
25
每日论坛发贴之星
日期:2005-05-23 01:01:10马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:08:092012新春纪念徽章
日期:2012-02-13 15:08:092012新春纪念徽章
日期:2012-02-13 15:08:092012新春纪念徽章
日期:2012-02-13 15:08:092012新春纪念徽章
日期:2012-02-13 15:08:09
40#
发表于 2005-2-3 11:04 | 只看该作者
两周前看这些很糊涂,现在,基本明白了.


看来也不能拔苗助长丫!

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表