转: OGG Checkpoint 详解
1.
OGG Checkpoint 详解
定位中断的位置,下次启动从中断的位置开始恢复。
1.target 端配置;
2.一条记录对应一个replicat
一. Extract Checkpoints
(1) Extract read checkpoints
(1) Startup checkpoint --ogg启动的时候创建
当Extract 进程启动的时候,会创建startup checkpoint,用来记录此时record的相关信息。该 checkpoint 是第一个checkpoint。
startup checkpoint的统计信息包含如下内容:
(1) Thread #: 创建checkpoint 的thread编号。
(2) Sequence #:创建checkpoint 时对应的sequence 号码。 --list archive log;
(3) RBA: 创建checkpoint 时,redo log 里面record 的relative byte address。
(4)Timestamp: 创建checkpoint 时record对应的timestamp。
(5)SCN: 创建checkpoint 时 record 对应的system change number 。
(6)Redo File: 创建checkpoint 时record对应的事务日志路径。
2 ) Recovery checkpoint
recover checkpoint 记录的是data source(online redo log 或者归档中)中Extract 最久没处理的record的位置。 该checkpoint 的统计信息和startup checkpoint一样。
3) Current checkpoint
current checkpoint 是data source中Extract 最后一次读取的record的位置。
GGSCI (ogg02) 4> info ext1
EXTRACT EXT1 Last Started 2014-12-27 17:42 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Process ID 31621
Log Read Checkpoint Oracle Redo Logs
2014-12-27 18:06:05 Seqno 15, RBA 18128896
SCN 0.1142344 (1142344)
Seqno 和 RBA 会变,说明ogg是在工作的。
GGSCI (ogg02) 5> info ext1,showch
EXTRACT EXT1 Last Started 2014-12-27 17:42 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Process ID 31621
Log Read Checkpoint Oracle Redo Logs
2014-12-27 18:11:06 Seqno 15, RBA 18188800
SCN 0.1142472 (1142472)
Current Checkpoint Detail:
Read Checkpoint #1
Oracle Redo Log
Startup Checkpoint (starting position in the data source):
Thread #: 1
Sequence #: 11
RBA: 7646224
Timestamp: 2014-12-27 16:20:48.000000
SCN: 0.1136079 (1136079)
Redo File: /oradata/ogg02/redo02.log
Recovery Checkpoint (position of oldest unprocessed transaction in the data source):
Thread #: 1
Sequence #: 15
RBA: 18187792
Timestamp: 2014-12-27 18:09:41.000000
SCN: 0.1142443 (1142443)
Redo File: /oradata/ogg02/redo03.log
Current Checkpoint (position of last record read in the data source):
Thread #: 1
Sequence #: 15
RBA: 18188800
Timestamp: 2014-12-27 18:11:06.000000
SCN: 0.1142472 (1142472)
Redo File: /oradata/ogg02/redo03.log
Write Checkpoint #1
GGS Log Trail
Current Checkpoint (current write position):
Sequence #: 4
RBA: 1755
Timestamp: 2014-12-27 18:11:43.251745
Extract Trail: /u01/zt/dirdat/lt
Trail Type: RMTTRAIL
Header:
Version = 2
Record Source = A
Type = 10
# Input Checkpoints = 1
# Output Checkpoints = 1
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = 3
Transaction Integrity = 1
Task Type = 0
Status:
Start Time = 2014-12-27 17:42:32
Last Update Time = 2014-12-27 18:11:43
Stop Status = A
Last Result = 400
二.Extract write checkpoints
该checkpoint包含如下信息:
(1)Sequence #: checkpoint 正在写的trail 文件的序列号。
(2)RBA: 创建checkpoint 时trail文件里record 的relative byte address。
(3)Timestamp: 创建checkpoint 时record对应的timestamp。
(4)Extract trail: trail 文件的路径。
(5)Trail Type: 标识trail 文件类型。有2个值:
EXTTRAIL:表示该trail 是本地的trail,文件由OGG进程直接写如本地disk。
RMTTRAIL:表示是远程的trail,该文件不会写入本地的磁盘,而是传到远端的的OGG上,在有远端OGG的collector 进程写disk。
比如pump 进程,里面就会写RMTTRAIL。
-----------------------------------------------------------------------------------------
target 端
GGSCI (ogg04) 1> info rep1
REPLICAT REP1 Last Started 2014-12-27 14:07 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
Process ID 26088
Log Read Checkpoint File /u01/zt/dirdat/lt000004
2014-12-27 16:49:03.408880 RBA 1755
GGSCI (ogg04) 2> info rep1,showch
REPLICAT REP1 Last Started 2014-12-27 14:07 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 26088
Log Read Checkpoint File /u01/zt/dirdat/lt000004
2014-12-27 16:49:03.408880 RBA 1755
Current Checkpoint Detail:
Read Checkpoint #1
GGS Log Trail
Startup Checkpoint (starting position in the data source):
Sequence #: 3
RBA: 20259
Timestamp: 2014-12-27 14:06:57.000000
Extract Trail: /u01/zt/dirdat/lt
Current Checkpoint (position of last record read in the data source): --最后一次读取文件的位置
Sequence #: 4
RBA: 1755
Timestamp: 2014-12-27 16:49:03.408880
Extract Trail: /u01/zt/dirdat/lt
Header:
Version = 2
Record Source = A
Type = 1
# Input Checkpoints = 1
# Output Checkpoints = 0
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = 0
Transaction Integrity = -1
Task Type = 0
Database Checkpoint:
Checkpoint table = ggs.checkpoint
Key = 982417365 (0x3a8e7fd5)
Create Time = 2014-12-27 10:46:19
Status:
Start Time = 2014-12-27 14:07:31
Last Update Time = 2014-12-27 17:03:30
Stop Status = A
Last Result = 400
GGSCI (ogg04) 3> info rep1 --看rba是否有变化
REPLICAT REP1 Last Started 2014-12-27 14:07 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
Process ID 26088
Log Read Checkpoint File /us01/zt/dirdat/lt000004
2014-12-27 16:49:03.408880 RBA 1755
----------------------------------------------------------------------
停的时候确保两边都事物都提交了。 info 一下看看
②. data dump进程:将队列数据发送到目标
好处:① .预防网络和源库的故障;
②. 可以对数据进行过来和转换;
③.synchronize方式从多个源库上合并数据到一个中心库;
④. synchronize方式将一个源库数据传到多个目标库;
2.
Checkpoint table有两种类型:主表和辅助表。主表根据用户定义名称来来创建,辅助表会自动创建。辅助表就是transaction table。名称是checkpoint table名上加_LOX。
SQL> conn ogg/ogg Connected. SQL> SQL> select table_name from user_tables; TABLE_NAME ------------------------------ CKKPOINT_LOX CKKPOINT <spancalibri',sans-serif; color:yellow?="">SQL> |
Checkpoint table配置方法:
(1):在./GLOBALS文件里添加checkpoint 表名
GGSCI(suys1) 1> view param ./GLOBALS ggschema ogg checkpointtableogg.checkpointtab GGSCI (suys1) 2> |
(2):连上DB,创建checkpoint表
GGSCI(suys1) 85> dblogin userid ogg, password ogg Successfullylogged into database.
GGSCI(suys1) 86> add checkpointtable ogg. checkpointtab Successfully created checkpoint table ogg.checkpointtab. |
--生成这个检查点记录表
(3):验证
conn ggs/ SQL> select * from checkpoint; GROUP_NA GROUP_KEY SEQNO RBA AUDIT_TS CREATE_TS LAST_UPDATE_ CURRENT_DIR -------- ---------- ------ ----------------------------------- ------------ ------------ -------------- REP1 3987940558 12 1564 2011-11-17 17:21:55.471376 17-NOV-11 17-NOV-11 /u01/ggate |
以上就介绍了OGG checkpoint table 说明,包括了方面的内容,希望对Oracle有兴趣的朋友有所帮助。