I. Functions of scn
The role of Scn is to ensure Database Consistency. It is the internal clock mechanism of Oracle. Scn is an important mechanism for oracle recovery.
Scn is everywhere in databases. Generally, the scn value is recorded in control files, data file headers, log files, and data files.
System scn is obtained from the view v $ database, corresponding to the checkpoint_change # field;
Datafile scn and last scn (stop scn) correspond to checkpoint_change #, last_change #,
Start scn is obtained from checkpoint_change # In v $ datafile_header.
Ii. view the current scn
There are three SCN types in the control: system SCN, datafile SCN, and last SCN (stop scn ),
System scn
SQL> select checkpoint_change # from v $ database;
CHECKPOINT_CHANGE #
------------------
451490
Datafile scn
SQL> select name, checkpoint_change # from v $ datafile;
NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE #
------------------
/Opt/app/oracle/oradata/wolf/system01.dbf
451490
/Opt/app/oracle/oradata/wolf/undotbs01.dbf
451490
/Opt/app/oracle/oradata/wolf/sysaux01.dbf
451490
NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE #
------------------
/Opt/app/oracle/oradata/wolf/users01.dbf
451490
Last scn (stop scn, stop scn infinity when started normally, last_change # It must be NULL)
SQL> select name, last_change # from v $ datafile;
NAME
--------------------------------------------------------------------------------
LAST_CHANGE #
------------
/Opt/app/oracle/oradata/wolf/system01.dbf
/Opt/app/oracle/oradata/wolf/undotbs01.dbf
/Opt/app/oracle/oradata/wolf/sysaux01.dbf
NAME
--------------------------------------------------------------------------------
LAST_CHANGE #
------------
/Opt/app/oracle/oradata/wolf/users01.dbf
The data file header contains an SCN: start SCN.
SQL> select name, checkpoint_change # from v $ datafile_header;
NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE #
------------------
/Opt/app/oracle/oradata/wolf/system01.dbf
451490
/Opt/app/oracle/oradata/wolf/undotbs01.dbf
451490
/Opt/app/oracle/oradata/wolf/sysaux01.dbf
451490
NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE #
------------------
/Opt/app/oracle/oradata/wolf/users01.dbf
451490