【原】根据scn查看数据是否成功写入磁盘

作者:david_zhang@sh 【转载时请以超链接形式标明文章】

链接:http://www.cnblogs.com/david-zhang-index/archive/2012/08/05/2624039.html

 1 SQL>  select file#,checkpoint_change#,to_char(checkpoint_time,'yyyy-mm-dd hh24:mi:ss') from v$datafile;
 2 
 3      FILE# CHECKPOINT_CHANGE# TO_CHAR(CHECKPOINT_
 4 ---------- ------------------ -------------------
 5          1            1787744 2012-08-05 16:04:29
 6          2            1787744 2012-08-05 16:04:29
 7          3            1787744 2012-08-05 16:04:29
 8          4            1787744 2012-08-05 16:04:29
 9          5            1787744 2012-08-05 16:04:29
10          6            1787744 2012-08-05 16:04:29
11          7            1787744 2012-08-05 16:04:29
12 
13 7 rows selected.
14 
15 SQL> select current_scn from v$database;
16 
17 CURRENT_SCN
18 -----------
19     1788412

说明SCN1787744之前的所有数据,已经同步到数据文件,但是之后的数据更改信息依然存在于内存中

scn_to_timestamp //SCN 和时间的转换工具

1 SQL> select to_char(scn_to_timestamp(1787744),'yyyy-mm-dd hh24:mi:ss') from dual;
2 
3 TO_CHAR(SCN_TO_TIME 
4 ------------------- 
5 2012-08-05 16:04:29
6 
7 SQL> !date Sun Aug  5 16:23:20 CST 2012

 //也就是说,2012-08-05 16:04:29之前的所有数据都已经写到了磁盘文件上

posted @ 2012-08-05 17:54  david_zhang@sh  阅读(330)  评论(0编辑  收藏  举报