我们知道ORACLE中有SCN(System Change Number)和Checkpoint_Change#,那这两者的关系是什么呢,其实Checkpoint_Change#是来源于SCN,SCN是时刻在变化的,Checkpoint_Change#是在数据发生了检查点的时候才改变的,它的值来源于SCN.下面通过一个例子来说明.
1.获取当前的SCN
SQL> select dbms_flashback.get_system_change_number() from dual;
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER()
-----------------------------------------
1275075
2.产生检查点
SQL> alter system checkpoint;
System altered.
3.从数据文件和数据头文件中查看检查点
SQL> column name format a50;
SQL> select name,checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF 1275080
SQL> select name, checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF 1275080
E:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF 1275080
从以上的输出可以看出Checkpoint_Change#非常接近SCN的值,说明Checkpoint_Change#来源于SCN,因为SCN时刻在变化,无法捕获到Checkpoint_Change#等于SCN的时刻.
来源:oschina
链接:https://my.oschina.net/u/2408025/blog/541387