为什么ora_rowscn更改而不更新表 [英] Why does ora_rowscn change without updating a table

查看:178
本文介绍了为什么ora_rowscn更改而不更新表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ora_rowscn来跟踪表上已更改的行并使用已更新的行.

I work with ora_rowscn to track the changed rows on a table and to work with updated rows.

上周,我注意到对于使用rowdependencies创建的部分(不是全部)表,ora_rowscn会发生变化,而表上没有任何事务.我的意思是,如果选择max(ora_rowscn),我总是得到更高的数字.

Last week I noticed that for some (not all) of my tables that I created with rowdependencies, the ora_rowscn changes without any transactions on the table. I mean if I select max(ora_rowscn) I get always higher number.

这是我创建表格的示例

  1. 创建表格

  1. creating table

create table test ( test_id number, txt varchar2(5) ) rowdependencies;

  • 将一些数据插入表

  • Inserted some data into the table

    insert into test values(1,'a');
    insert into test values(2,'b');
    insert into test values(3,'c');
    

  • 使用ORA_ROWSCN多次查询表

  • Queried the table more than once with ORA_ROWSCN

    select max(ora_rowscn),max(b.current_scn) from test a, v$database b
    

  • 每次查询时,我都会得到更高的max(ora_rowscn).

    Every time I queried I got a higher max(ora_rowscn).

    在MetaLink上,我发现了两个报告的错误(错误14093863,错误9814923),似乎是相同的问题,但设置为不是错误.

    On MetaLink i found two reported Bugs (Bug 14093863, Bug 9814923) that seems to be the same problem, but set as not a Bug.

    为什么会发生这种情况?如何解决或解决该问题?

    Why does it happen and what is the solution to get it work or fix it?

    推荐答案

    我们询问了Oracle联系人并获得了以下答案.

    we asked our Oracle contact and got the following answer.

    这不是bug,它没有记录的功能."

    "It is not a bug, its undocumented feature."

    在清除块时生成ORA_ROWSCN 交易.可能发生两种清除的块:快速 清理并延迟清理.

    The ORA_ROWSCN is generated when the blocks are cleaning out the transactions. There are two kinds of block clean out may occur: fast clean out and delayed clean out.

    请注意,对于延迟清除,事务的确切commit-scn 当该交易修改的区块为 清理出去,因此我们可能会获得commit-scn的上限. 因此,对于那些快速清除的块,我们可以更新ORA_ROWSCN 交易刚完成后;

    Note that for delayed clean out, the exact commit-scn of a transaction may not be available when a block modified by that transaction is cleaned out and therefore we may get upper-bounds for the commit-scn. So, for those blocks with fast clean out we can update the ORA_ROWSCN right after the commit of a transaction;

    但是,对于那些延迟清除的块,我们仅更新 下次我们触摸该块时对应的ORA_ROWSCN(DML或 选择).可能要过几个小时.我们可能是 在其他表中做很多工作人员(因此SCN会增加) 并且我们不在表T中进行任何交易.但是当我们 查询表T的ORA_ROWSCN,我们仍然可以获得最近的数据 对于SCN,因为该块刚刚被清除(但是 交易已在几个小时前提交).这个ORA_ROWSCN是 最后一笔交易的提交时间上限.

    However, for those blocks with delayed clean out we only update the corresponding ORA_ROWSCN the next time we touch the block(DML or select). It can be several hours later. It is possible that we are doing bunch of staff in other tables (thus the SCNs get incremented) and we are not doing any transaction in this table T. However when we queried the ORA_ROWSCN for table T we can still get a recent figure for SCN, since the block has just been cleaned out (but the transaction has been committed several hours ago). This ORA_ROWSCN is the upper bound of the commit time for the last transaction.

    问题的外观确实存在.如果我已正确理解,则此情况没有简单的解决方案.

    How it looks the problem does exist. If I have understood correctly, there no simple solution for this case.

    我希望这将有助于了解其他用户的问题.

    I hope it would help to understand other user the problem.

    在这里,我发现了有关块清除的更多不完整信息

    Here i found some more unsefull information about block cleanout

    • Clean it up by Jonathan Lewis
    • Delayed Block cleanout

    这篇关于为什么ora_rowscn更改而不更新表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆