查询scn

1.查询系统当前SCN两条命令
SQL> select current_scn from v$ database ;
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
                  1781893
 
2.数据库全局-检查点 SCN,在控制文件中。
SYS@bys1> select dbid,checkpoint_change# from v$ database ;
       DBID CHECKPOINT_CHANGE#
---------- ------------------
3957527513            1753478
 
3.当前数据文件SCN。在控制文件中。即 checkpoint scn,表示该数据文件最近一次执行检查点操作时的SCN
SQL> select name ,checkpoint_change# from v$datafile;
NAME                                               CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
/u01/oradata/bys1/system01.dbf                                1753478
/u01/oradata/bys1/sysaux01.dbf                                1753478
SQL> select file#, name ,checkpoint_change#,to_char(checkpoint_time, 'yyyy-mm-dd hh24:mi:ss' ) cptime from v$datafile;
      FILE# NAME                                               CHECKPOINT_CHANGE# CPTIME
---------- -------------------------------------------------- ------------------ -------------------
          1 /u01/oradata/bys1/system01.dbf                                1753478 2013-09-11 23:00:52
          2 /u01/oradata/bys1/sysaux01.dbf                                1753478 2013-09-11 23:00:52
 
4.查询数据文件头SCN,在数据文件头
SQL> select name ,checkpoint_change# from v$datafile_header;
NAME                                     CHECKPOINT_CHANGE#
---------------------------------------- ------------------
/u01/app/oracle/oradata/bys001/system01.dbf            1198546
 
5.数据文件结束SCN,在控制文件中。
LAST_CHANGE#,如果数据库非正常关闭值为 NULL 。正常关闭是关闭时的SCN。
实例恢复就是在打开数据库时检查此参数确定是否需要恢复。
数据库 OPEN 时LAST_CHANGE#也为 NULL ,因为不确定SCN多少时关闭。
SQL> select name ,last_change# from v$datafile;
NAME                                     LAST_CHANGE#
---------------------------------------- ------------
/u01/app/oracle/oradata/bys001/system01.dbf
 
6.日志中所含SCN范围
SQL> select GROUP #, sequence #,STATUS,FIRST_CHANGE#,to_char(FIRST_TIME, 'yyyy/mm/dd:hh24:mi:ss' ) time from V$log;
     GROUP SEQUENCE # STATUS           FIRST_CHANGE# TIME
---------- ---------- ---------------- ------------- -------------------
          1         49 INACTIVE               1713778 2013/09/11:10:10:08
          2         50 INACTIVE               1744790 2013/09/11:21:34:23
          3         51 CURRENT                1753478 2013/09/11:23:00:52

 

你可能感兴趣的:(oracle)