在Oracle10g中,Oracle对v$database视图做出增强,增加了很多字段,其中一个重要字段是:CURRENT_SCN,代表数据库当前的SCN:
SQL> select * from v$version;
BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod PL/SQL Release 10.2.0.1.0 - Production CORE 10.2.0.1.0 Production TNS for Linux: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production
SQL> desc v$database Name Null? Type ----------------------------------------- -------- ---------------------------- DBID NUMBER NAME VARCHAR2(9) ................... CURRENT_SCN NUMBER FLASHBACK_ON VARCHAR2(18) SUPPLEMENTAL_LOG_DATA_FK VARCHAR2(3) SUPPLEMENTAL_LOG_DATA_ALL VARCHAR2(3) DB_UNIQUE_NAME VARCHAR2(30) STANDBY_BECAME_PRIMARY_SCN NUMBER FS_FAILOVER_STATUS VARCHAR2(21) FS_FAILOVER_CURRENT_TARGET VARCHAR2(30) FS_FAILOVER_THRESHOLD NUMBER FS_FAILOVER_OBSERVER_PRESENT VARCHAR2(7) FS_FAILOVER_OBSERVER_HOST VARCHAR2(512)
|
这个字段来自底层基础表x$kccdi ,其中的字段为:DICUR_SCN , DI代表Database Information ,cur_scn 代表 current SCN:
SQL> desc x$kccdi Name Null? Type ----------------------------------------- -------- ----------------- ADDR RAW(4) INDX NUMBER ............... DIPLID NUMBER DIPLN VARCHAR2(101) DICUR_SCN VARCHAR2(16) DIDBUN VARCHAR2(30) DIFSTS NUMBER DIFOPR NUMBER DIFTHS NUMBER DIFTGT VARCHAR2(30) DIFOBS VARCHAR2(512) |
这个SCN值和9i中引入的dbms_flashback.get_system_change_number获得的值相同:
SQL> select 2 (select dicur_scn from x$kccdi ) a, 3 (select dbms_flashback.get_system_change_number a from dual) b 4 from dual;
A B ---------------- ------------------ 8905603606859 8905603606859 |
查看本文来源