SCN试验之二 checkpoin scn 与数据库scn的关系

时间:2024-08-12 14:36:56

oracle11g

观察数据库scn:

SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                 1025713

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#
------------------
           1022214

SQL>

********************************

强制执行checkpoint:

SQL> alter system checkpoint;

System altered.

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#
------------------
           1025732
可以看到,此时 checkpoint_change# 比刚才的数据库scn 要大一些。这是因为数据库scn 随着时间的增长而增长。

SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                 1025755

SQL> alter system checkpoint;

System altered.

SQL>

SQL> select checkpoint_change# from v$database;

CHECKPOINT_CHANGE#
------------------
           1025765

SQL> select name, checkpoint_change# from v$datafile;

NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE#
------------------
/u01/app/oracle/oradata/orcl/system01.dbf
           1025765

/u01/app/oracle/oradata/orcl/sysaux01.dbf
           1025765

/u01/app/oracle/oradata/orcl/undotbs01.dbf
           1025765

NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE#
------------------
/u01/app/oracle/oradata/orcl/users01.dbf
           1025765

/u01/app/oracle/oradata/orcl/example01.dbf
           1025765

SQL> select name, checkpoint_change# from v$datafile_header;

NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE#
------------------
/u01/app/oracle/oradata/orcl/system01.dbf
           1025765

/u01/app/oracle/oradata/orcl/sysaux01.dbf
           1025765

/u01/app/oracle/oradata/orcl/undotbs01.dbf
           1025765

NAME
--------------------------------------------------------------------------------
CHECKPOINT_CHANGE#
------------------
/u01/app/oracle/oradata/orcl/users01.dbf
           1025765

/u01/app/oracle/oradata/orcl/example01.dbf
           1025765

SQL>