The SCN and checkpoint mechanism of Oracle
The SCN appears in several forms on Oracle's documentation, one for system change number and one for system Commit, and in most cases, the definition of Systems change numbers is more accurate.
The SCN (System change number) is what is commonly referred to as an alteration, a very important data structure in the database that identifies the version that the database commits at some exact moment. When a transaction commits, it is given a unique SCN that identifies the transaction. The SCN is also used as the internal clock mechanism of the Oracle database, and can be seen as a logical clock, with each database having a global SCN generator.
As a logical clock inside the database, database transactions are sorted by SCN, and Oracle also implements important database functions such as consistent read (read consistency) based on the SCN, and for distributed transactions (distributed transactions), The SCN is also extremely important. The SCN is unique in the database and increases over time, but may not be consistent. The value of the SCN will never be reset to 0 unless the database is rebuilt.
There has been a lot of controversy over SCN, and many people think that SCN refers to system commit number, and usually the SCN changes when committed, so many times these two nouns are often repeated in the document. Even in Oracle's official documentation, the SCN often appears in the system change/commit number two form.
Which word is actually not the most important, it is important to know that the SCN is the clock mechanism within Oracle, Oracle maintains database consistency through the SCN, and implements Oracle's critical recovery mechanism through the SCN.
SCN is ubiquitous in the database, and the common transaction table, control file, data file header, log file, data block, etc. are recorded with SCN values. With different prefixes, the SCN also has a different name, such as the checkpoint SCN (Checkpoint SCN), Resetlogs SCN, and so on. The SCN consists of two parts, the high-level SCN wrap is recorded by 2 bytes, and the low SCN base is recorded by 4 bytes, as shown in 2-1.
There are several ways to get the current or approximate SCN for a database.
Select Current_scn from V$database;
The SCN and checkpoint mechanism of Oracle