Http://www.eygle.com/archives/2007/06/oracle10g_current_scn.html
A friend asked me a question a few days ago:
How is the current_scn of Oracle10g calculated?
We know that Oracle10g introduces current_scn in the v $ database view. This SCN comes from the underlying table and represents the current SCN. in Oracle9i, we can use dbms_flashback.get_system_change_number to obtain the SCN of the system.
But note that current_scn is still different. Let's take a look at the next query:
[Oracle @ danaly ~] $ Sqlplus '/as sysdba'
SQL * Plus: Release 10.2.0.1.0-Production on Thu Jun 21 10:15:08 2007
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
SQL> @ scn
SQL> col current_scn for 99999999999999999
SQL> select current_scn from v $ database;
CURRENT_SCN
------------------
8910961765228
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
8910961765228
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
8910961765228
SQL> select current_scn from v $ database;
CURRENT_SCN
------------------
8910961765229
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
8910961765229
SQL> select dbms_flashback.get_system_change_number current_scn from dual;
CURRENT_SCN
------------------
8910961765229
SQL> select current_scn from v $ database;
CURRENT_SCN
------------------
8910961765230
We can see that the query of current_scn will directly lead to the improvement of SCN, but not in other ways. That is to say, the current_scn here is like a Sequence, and the query will increase. This is also easy to understand. Only by enhancing the Current SCN can v $ database ensure that the obtained SCN is Current. But what if no query is performed? This value will certainly not grow.
That is to say, you do not know the value of current_scn if you do not query it. It changes when you query it. Is it a bit like that of schörör's cat?