为前缀表如何服务于Flashback Data Archive(3)

STARTSCN          ENDSCN XID              O COLUMN_NAME          TYPE                HISTORICAL_COLUMN_NA
---------------- ---------------- ---------------- - -------------------- -------------------- --------------------
  12723378739636                                    ID                  NUMBER              ID
  12723378739636  12723378742951                    C3                  VARCHAR2(3)          C2
  12723378742951                                    C3                  VARCHAR2(3)          C3

结果表明在scn:12723378739636~12723378742951范围内源表的C3字段对应archive table的C2字段,从Scn:12723378742951开始源表的C3字段对应archive table的C3字段

---SYS_FBA_TCRV_36945表
col rid format a20
set linesize 130
select * from SYS_FBA_TCRV_36945;
RID                          STARTSCN          ENDSCN XID              O
-------------------- ---------------- ---------------- ---------------- -
AAAJBRAAEAAAWjJAAA    12723378739723                  000A000500015C8E I
AAAJBRAAEAAAWjJAAB    12723378739723                  000A000500015C8E I
AAAJBRAAEAAAWjJAAC    12723378739723                  000A000500015C8E I

SCOTT@tstdb1-SQL> select ora_rowscn from T0516_5;

ORA_ROWSCN
----------------
  12723378739723
  12723378739723
  12723378739723

SYS@tstdb1-SQL> select xid,row_id,operation,undo_sql from flashback_transaction_query where xid=hextoraw('000A000500015C8E');

XID              ROW_ID              OPERATION  UNDO_SQL
---------------- ------------------- ---------- ----------------------------------------------------------------------
000A000500015C8E AAAJBRAAEAAAWjJAAC  INSERT    delete from "SCOTT"."T0516_5" where ROWID = 'AAAJBRAAEAAAWjJAAC';
000A000500015C8E AAAJBRAAEAAAWjJAAB  INSERT    delete from "SCOTT"."T0516_5" where ROWID = 'AAAJBRAAEAAAWjJAAB';
000A000500015C8E AAAJBRAAEAAAWjJAAA  INSERT    delete from "SCOTT"."T0516_5" where ROWID = 'AAAJBRAAEAAAWjJAAA';
000A000500015C8E                    BEGIN

结合flashback_transaction_query,发现SYS_FBA_TCRV_36945记录了执行insert语句的transaction_id,行的rowid、以及插入的时间
     
---update一条记录
SCOTT@tstdb1-SQL> select * from t0516_5;

ID C3
---------------- ---
              1 AAA
              2 BBB
              3 CCC
             
update t0516_5 set c3='DDD' where id=3;
commit;

---再delete一条记录
delete t0516_5 where id=2;
commit;

SCOTT@tstdb1-SQL> select * from t0516_5;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/cdb7d569b9fe4ad8aa44d7184a208417.html