<legend id='tDMlY'><style id='tDMlY'><dir id='tDMlY'><q id='tDMlY'></q></dir></style></legend>
  • <i id='tDMlY'><tr id='tDMlY'><dt id='tDMlY'><q id='tDMlY'><span id='tDMlY'><b id='tDMlY'><form id='tDMlY'><ins id='tDMlY'></ins><ul id='tDMlY'></ul><sub id='tDMlY'></sub></form><legend id='tDMlY'></legend><bdo id='tDMlY'><pre id='tDMlY'><center id='tDMlY'></center></pre></bdo></b><th id='tDMlY'></th></span></q></dt></tr></i><div id='tDMlY'><tfoot id='tDMlY'></tfoot><dl id='tDMlY'><fieldset id='tDMlY'></fieldset></dl></div>

    1. <small id='tDMlY'></small><noframes id='tDMlY'>

      <tfoot id='tDMlY'></tfoot>
          <bdo id='tDMlY'></bdo><ul id='tDMlY'></ul>

        如何找出上次更新 Oracle 表的时间

        时间:2023-09-20

        <small id='YFCd5'></small><noframes id='YFCd5'>

      1. <i id='YFCd5'><tr id='YFCd5'><dt id='YFCd5'><q id='YFCd5'><span id='YFCd5'><b id='YFCd5'><form id='YFCd5'><ins id='YFCd5'></ins><ul id='YFCd5'></ul><sub id='YFCd5'></sub></form><legend id='YFCd5'></legend><bdo id='YFCd5'><pre id='YFCd5'><center id='YFCd5'></center></pre></bdo></b><th id='YFCd5'></th></span></q></dt></tr></i><div id='YFCd5'><tfoot id='YFCd5'></tfoot><dl id='YFCd5'><fieldset id='YFCd5'></fieldset></dl></div>
          • <bdo id='YFCd5'></bdo><ul id='YFCd5'></ul>
              <tbody id='YFCd5'></tbody>

            <tfoot id='YFCd5'></tfoot>
              • <legend id='YFCd5'><style id='YFCd5'><dir id='YFCd5'><q id='YFCd5'></q></dir></style></legend>

                • 本文介绍了如何找出上次更新 Oracle 表的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我能否找出最后一次对 Oracle 数据库中的表执行 INSERT、UPDATE 或 DELETE 语句的时间,如果是,如何知道?

                  Can I find out when the last INSERT, UPDATE or DELETE statement was performed on a table in an Oracle database and if so, how?

                  一点背景:Oracle 版本是 10g.我有一个定期运行的批处理应用程序,从单个 Oracle 表读取数据并将其写入文件.如果自上次作业运行以来数据没有改变,我想跳过这个.

                  A little background: The Oracle version is 10g. I have a batch application that runs regularly, reads data from a single Oracle table and writes it into a file. I would like to skip this if the data hasn't changed since the last time the job ran.

                  该应用程序是用 C++ 编写的,并通过 OCI 与 Oracle 通信.它以普通"用户身份登录 Oracle,因此我无法使用任何特殊的管理工具.

                  The application is written in C++ and communicates with Oracle via OCI. It logs into Oracle with a "normal" user, so I can't use any special admin stuff.

                  好的,特殊管理人员"并不是一个很好的描述.我的意思是:除了从表中选择和调用存储过程之外,我不能做任何事情.如果想在 2010 年之前完成它,那么更改数据库本身的任何内容(如添加触发器)很遗憾不是一个选项.

                  Okay, "Special Admin Stuff" wasn't exactly a good description. What I mean is: I can't do anything besides SELECTing from tables and calling stored procedures. Changing anything about the database itself (like adding triggers), is sadly not an option if want to get it done before 2010.

                  推荐答案

                  由于您使用的是 10g,您可能会使用 ORA_ROWSCN 伪列.这为您提供了导致行更改的最后一个 SCN(系统更改编号)的上限.由于这是一个递增序列,您可以存储您所看到的最大 ORA_ROWSCN,然后仅查找 SCN 大于该值的数据.

                  Since you are on 10g, you could potentially use the ORA_ROWSCN pseudocolumn. That gives you an upper bound of the last SCN (system change number) that caused a change in the row. Since this is an increasing sequence, you could store off the maximum ORA_ROWSCN that you've seen and then look only for data with an SCN greater than that.

                  默认情况下,ORA_ROWSCN 实际上是在块级别维护的,因此对块中任何行的更改都会更改块中所有行的 ORA_ROWSCN.如果我们谈论的是正常"数据访问模式,而目的是尽量减少多次处理的行数,而无需更改,那么这可能就足够了.您可以使用 ROWDEPENDENCIES 重建表,这将导致在行级别跟踪 ORA_ROWSCN,这为您提供更详细的信息,但需要一次性的努力来重建表.

                  By default, ORA_ROWSCN is actually maintained at the block level, so a change to any row in a block will change the ORA_ROWSCN for all rows in the block. This is probably quite sufficient if the intention is to minimize the number of rows you process multiple times with no changes if we're talking about "normal" data access patterns. You can rebuild the table with ROWDEPENDENCIES which will cause the ORA_ROWSCN to be tracked at the row level, which gives you more granular information but requires a one-time effort to rebuild the table.

                  另一种选择是配置更改数据捕获 (CDC) 之类的内容,并使您的 OCI 应用程序订阅表更改,但这也需要一次性配置 CDC.

                  Another option would be to configure something like Change Data Capture (CDC) and to make your OCI application a subscriber to changes to the table, but that also requires a one-time effort to configure CDC.

                  这篇关于如何找出上次更新 Oracle 表的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Oracle:如何查明是否有待处理的事务? 下一篇:如何从表中选择所有列,以及 ROWNUM 等附加列?

                  相关文章

                    <tfoot id='yHnTw'></tfoot>

                    <i id='yHnTw'><tr id='yHnTw'><dt id='yHnTw'><q id='yHnTw'><span id='yHnTw'><b id='yHnTw'><form id='yHnTw'><ins id='yHnTw'></ins><ul id='yHnTw'></ul><sub id='yHnTw'></sub></form><legend id='yHnTw'></legend><bdo id='yHnTw'><pre id='yHnTw'><center id='yHnTw'></center></pre></bdo></b><th id='yHnTw'></th></span></q></dt></tr></i><div id='yHnTw'><tfoot id='yHnTw'></tfoot><dl id='yHnTw'><fieldset id='yHnTw'></fieldset></dl></div>
                  1. <legend id='yHnTw'><style id='yHnTw'><dir id='yHnTw'><q id='yHnTw'></q></dir></style></legend>

                    <small id='yHnTw'></small><noframes id='yHnTw'>

                      <bdo id='yHnTw'></bdo><ul id='yHnTw'></ul>