???? Oracle11g ????????? No.2 - v$database.CURRENT_SCN
- by Todd Bao
«????Oracle 11g ???????»???????????,?11.2.0.3.0?????:
select current_scn from v$database
union all
select current_scn from v$database;
??????????SCN,??????11.2.0.1.0???????????SCN??????
??,????11.2.0.1.0????,11.2.0.3.0????X$KCCDI(V$DATABASE?????,??CURRENT_SCN??)??,?????????SCN?
----------------------------------------------------| Id | Operation | Name |----------------------------------------------------| 0 | SELECT STATEMENT | || 1 | MERGE JOIN CARTESIAN| ||* 2 | FIXED TABLE FULL | X$KCCDI || 3 | BUFFER SORT | || 4 | VIEW | VW_JF_SET$6E0AEE5B || 5 | UNION-ALL | || 6 | FIXED TABLE FULL| X$KCCDI2 || 7 | FIXED TABLE FULL| X$KCCDI2 |----------------------------------------------------
??????11.2.0.3.0???????SQL??v$database????current_scn????????:???????X$KCCDI???dicur_scn(current_scn)???????
a. ???:????union all,???????,??????????X$KCCDI2(V$DATABASE??????)?VIEW????,??X$KCCDI?X$KCCDI2????,???X$KCCDI??,??:
SYS@fmw//Scripts> run 1 select current_scn from v$database 2 union all select current_scn from v$database 3 union all select current_scn from v$database 4* union all select current_scn from v$databaseCURRENT_SCN----------- 5074384 5074385 5074385 50743854 rows selected.
??,X$KCCDI?????????,??????????SCN??????SCN????????“?”SCN?
b. ???:???????,??:
SYS@fmw//Scripts> run 1 select current_scn,status from v$database,v$instance 2 union all 3* select current_scn,status from v$database,v$instanceCURRENT_SCN + STATUS----------- + ------------------------ 5075463 + OPEN 5075464 + OPEN2 rows selected.
c. ???:?????????:
SYS@fmw//Scripts> run 1* select a.current_scn,b.current_scn from v$database a,v$database bCURRENT_SCN + CURRENT_SCN----------- + ----------- 5078328 + 50783291 row selected.
????UNION ALL??????
d. ??,???X$KCCDI??????????????????“??”??=D,????????X$?????????$???,???????,????V$DATABASE?????????????????:
SYS@fmw//Scripts> run 1 select dicur_scn from x$kccdi 2* union all select dicur_scn from x$kccdiDICUR_SCN--------------------------------508218350821842 rows selected.
SYS@fmw//Scripts> run 1* select a.dicur_scn,b.dicur_scn from x$kccdi a,x$kccdi bDICUR_SCN + DICUR_SCN-------------------------------- + --------------------------------5082913 + 50829141 row selected.
???
Todd Bao
??,???????????,?????????SCN,????V$DATABASE.CURRENT_SCN?,???????“next scn”?
×??,???demo????11.2.0.3.???