The following articles mainly explain how current_scn in Oracle10g is correctly computed and run. We all know that Oracle10g introduces current_scn in the v $ database view. In fact, this SCN comes from the underlying table, indicates 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:
Copy code
- 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, 2005, Oracle. All rights reserved.
- Connected to:
- 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. The above content is an introduction to the current_scn computing of Oracle10g. I hope you will have some gains.