Chinaunix首页 | 论坛 | 博客
  • 博客访问: 380626
  • 博文数量: 113
  • 博客积分: 3035
  • 博客等级: 中校
  • 技术积分: 1430
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-01 16:32
文章分类
文章存档

2011年(42)

2010年(70)

2009年(1)

我的朋友

分类: Oracle

2010-11-09 15:54:23

增量检查点
每3s发生一次,更新控制文件的
且看16:02:27 sys@FOX> ALTER SESSION SET EVENTS 'immediate trace name controlf level 2';
***************************************************************************
CHECKPOINT PROGRESS RECORDS
***************************************************************************
 (blkno = 0x8, size = 104, max = 8, in-use = 1, last-recid= 0)
THREAD #1 - status:0x2 flags:0x0 dirty:45
low cache rba:(0x38.1c61.0) on disk rba:(0x38.1ccc.0)
on disk scn: 0x0000.92a01cbd 11/09/2010 15:58:02
resetlogs scn: 0x0000.006bbcfc 10/14/2010 16:12:47
heartbeat: 734604656 mount id: 923260847
MTTR statistics status: 3
Init time: Avg: 13449136, Times measured: 3
File open time: Avg: 62585, Times measured: 33
Log block read time: Avg: 42, Times measured: 14337
Data block handling time: Avg: 558, Times measured: 1
THREAD #2 - status:0x0 flags:0x0 dirty:0
low cache rba:(0x0.0.0) on disk rba:(0x0.0.0)
on disk scn: 0x0000.00000000 01/01/1988 00:00:00
resetlogs scn: 0x0000.00000000 01/01/1988 00:00:00
heartbeat: 0 mount id: 0
。。。。。。。
****************************************************************************
查动态视图,并没有发现增量检查点的变化
sys@FOX> select file#,name,last_change#,checkpoint_change# from v$datafile;

     FILE# NAME                                               LAST_CHANGE# CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------ ------------------
         1 D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                                      2459966139
         2 D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                                     2459966139
         3 D:\ORACLE\ORADATA\FOX\INDX01.DBF                                        2459966139
         4 D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                                       2459966186
         5 D:\ORACLE\ORADATA\FOX\USERS01.DBF                                       2459966139
         6 D:\ORACLE\ORADATA\FOX\DEMO01.DBF                                        2459966139
         8 D:\ORACLE\ORADATA\FOX\RMAN.DBF                                          2459966139

7 rows selected.

sys@FOX> select name,fuzzy,checkpoint_change# from v$datafile_header;

NAME                                               FUZ CHECKPOINT_CHANGE#
-------------------------------------------------- --- ------------------
D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                 YES         2459966139
D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                YES         2459966139
D:\ORACLE\ORADATA\FOX\INDX01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                  YES         2459966186
D:\ORACLE\ORADATA\FOX\USERS01.DBF                  YES         2459966139
D:\ORACLE\ORADATA\FOX\DEMO01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\RMAN.DBF                     YES         2459966139

7 rows selected.

sys@FOX> create table tx tablespace users as select * from dba_objects where rownum<=10 ;

Table created.

sys@FOX> insert into tx select * from tx;

10 rows created.

sys@FOX> commit;

Commit complete.

sys@FOX> select name,fuzzy,checkpoint_change# from v$datafile_header;

NAME                                               FUZ CHECKPOINT_CHANGE#
-------------------------------------------------- --- ------------------
D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                 YES         2459966139
D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                YES         2459966139
D:\ORACLE\ORADATA\FOX\INDX01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                  YES         2459966186
D:\ORACLE\ORADATA\FOX\USERS01.DBF                  YES         2459966139
D:\ORACLE\ORADATA\FOX\DEMO01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\RMAN.DBF                     YES         2459966139

7 rows selected.

sys@FOX> select file#,name,last_change#,checkpoint_change# from v$datafile;

     FILE# NAME                                               LAST_CHANGE# CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------ ------------------
         1 D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                                      2459966139
         2 D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                                     2459966139
         3 D:\ORACLE\ORADATA\FOX\INDX01.DBF                                        2459966139
         4 D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                                       2459966186
         5 D:\ORACLE\ORADATA\FOX\USERS01.DBF                                       2459966139
         6 D:\ORACLE\ORADATA\FOX\DEMO01.DBF                                        2459966139
         8 D:\ORACLE\ORADATA\FOX\RMAN.DBF                                          2459966139

7 rows selected.

sys@FOX> set time on
15:38:54 sys@FOX>
15:38:58 sys@FOX>
15:38:59 sys@FOX> select file#,name,last_change#,checkpoint_change# from v$datafile;

     FILE# NAME                                               LAST_CHANGE# CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------ ------------------
         1 D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                                      2459966139
         2 D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                                     2459966139
         3 D:\ORACLE\ORADATA\FOX\INDX01.DBF                                        2459966139
         4 D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                                       2459966186
         5 D:\ORACLE\ORADATA\FOX\USERS01.DBF                                       2459966139
         6 D:\ORACLE\ORADATA\FOX\DEMO01.DBF                                        2459966139
         8 D:\ORACLE\ORADATA\FOX\RMAN.DBF                                          2459966139

7 rows selected.

15:39:03 sys@FOX> select name,fuzzy,checkpoint_change# from v$datafile_header;

NAME                                               FUZ CHECKPOINT_CHANGE#
-------------------------------------------------- --- ------------------
D:\ORACLE\ORADATA\FOX\SYSTEM01.DBF                 YES         2459966139
D:\ORACLE\ORADATA\FOX\UNDOTBS01.DBF                YES         2459966139
D:\ORACLE\ORADATA\FOX\INDX01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\TOOLS01.DBF                  YES         2459966186
D:\ORACLE\ORADATA\FOX\USERS01.DBF                  YES         2459966139
D:\ORACLE\ORADATA\FOX\DEMO01.DBF                   YES         2459966139
D:\ORACLE\ORADATA\FOX\RMAN.DBF                     YES         2459966139

7 rows selected.

网上摘抄如下,作一记录,待日后再体会
注意:增量检查点并不去更新数据文件头,只是在控制文件中记录了checkpoint progress record这个区域,记下low rba,on-disk rba等信息。这些信息就可以用来快速恢复。

每隔3秒钟ckpt会去更新控制文件中的checkpoint progress recored区域,记录checkpoint执行的情况。

解疑:这里应该是只更新控制文件每3秒不是更新数据文件头, 而是在控制文件中记录checkpoint的执行情况,基于增量检查点和checkpoint  queue的原理,在发生检查点的时候,ckpt 进程每次只是告诉dbwr,写dirty  buffe要一直写到最新这个位置(发生检查点:也就是alter system checkpoint),这样做呢,仅仅是告诉dbwr一个checkpoint queue中的结束点,ckpt绝对不会等到dbwr写完所有脏数据在更新控制文件和数据文件头,而是每3秒钟,在控制文件中的checkpoint progress recored区域中报告一下dbwr最新写入的位置(也就是dbwr的写状态的scn)。这样使得,比如要做恢复的时候(instance  recovery)可以从这个最新报告的scn位置开始做恢复,而不是从数据文件中的checkpoint  scn开始做恢复,这样将缩短恢复时间,尤其是instance  crash的情况下启动更快。另外要注意的是,检查点发生的时候,ckpt 去更新数据文件头和控制文件,并不是把当前检查点发生时候的scn 更新进去,而是把上一次dbwr写入已经完成的检查点发生时候的  scn 更新进去,也就是说,更新控制文件和数据文件头是滞后于检查点的发生的,这个从恢复的原理也很容易理解,因为检查点发生的时候dirty buffer还没有写入,自然不能立即更新成当前的scn了。



阅读(796) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~