How is the current_scn of Oracle10g calculated?

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.