Oracle Golden Gate 系列十三 -- 配置GG进程检查点(checkpoint) 说明
?
一.Checkpoints 理論說明
有關GG的Checkpoints 在系列一, GG的架構中以說明:
OracleGolden Gate 系列一 --GG 架構 說明
http://blog.csdn.net/tianlesoftware/article/details/6925907
?
這里在單獨拿出來說明一下,因為這是一個較為重要的概念。
?
Checkpoints storethe current read and write positions of a process to disk for recovery purposes.These checkpoints ensure that data changes that are marked for synchronizationactually are extracted by Extract and replicated by Replicat, and they preventredundant processing.
--Checkpoint 存儲了進程當前讀和寫的位置。 Checkpoints 保證已經改變的數據已經同步,從而阻止其他冗余的操作。
They providefault tolerance by preventing the loss of data should the system, the network,or an Oracle GoldenGate process need to be restarted. For complexsynchronization configurations, checkpoints enable multiple Extract or Replicatprocesses to read from the same set of trails.
--通過Checkpoints 可以在以下情況下的數據丟失:系統或者網絡故障,重啟GG進程。Checkpoints支持多個Extact 或者Replicat 進程讀取同一個trail 文件。
Checkpoints workwith inter-process acknowledgments to prevent messages from being lost in thenetwork. Oracle GoldenGate has a proprietary guaranteed-message delivery technology.
?
Extract createscheckpoints for its positions in the data source and in the trail. Replicat createscheckpoints for its position in the trail.
?????? --默認情況下Extract 和 Replicat 進程都會在trail文件里記錄checkpoints 的位置。
?
A checkpointsystem is used by Extract and Replicat processes that operate continuously, butit is not required by Extract and Replicat processes that run in batch mode. Abatch process can be re-run from its start point, whereas continuous processingrequires the support for planned or unplanned interruptions that is provided bycheckpoints.
--checkpoints 機制保證了Extract 和 Replicat 進程可以連續的操作。
?
Replicat storesits checkpoints in a checkpoint table in the target database to couple the commitof its transaction with its position in the trail file. This ensures that atransaction will only be applied once, even if there is a failure of theReplicat process or the database process. For reporting purposes, Replicat alsohas a checkpoint file on disk in the dirchk subdirectory of the OracleGoldenGate directory.
--Replicat 在Target 庫的checkpoint 表里記錄了已經提交了事務在trail 文件里的位置。這樣就可以保證事務只被應用一次,即使在replicat 進程或者DB 出現故障的情況下。 為了做報告,Replicat也會在GG 安裝目錄的dirchk 目錄里存放一個checkpoint 文件。
?
You canoptionally configure Replicat to use this file as its sole checkpoint store,and not use a checkpoint table at all. In this mode, however, there can becases where the checkpoint in the file is not consistent with what was appliedafter a database recovery, if the failure either rolled back or rolled forwarda transaction that was considered applied by Replicat. The checkpoint table guaranteesconsistency after recovery.
--我們可以在不使用checkpoint 的情況下,配置Replicat 進程使用這個本地的文件來存儲checkpoint,但是使用本地的checkpoint 文件, 在數據庫做了recover的情況下,不能保證數據的一致性。
在事務rolled back 或 rolledforward失敗的情況下,使用本地checkpoint 文件還是可以保證一致性。
而如果使用checkpoint table,在databaserecover 的情況下也可以保證數據的一致性。 所以推薦也是使用checkpont。
?
Replicatmaintains checkpoints that provide a known position in the trail from which to startafter an expected or unexpected shutdown. To store a record of its checkpoints,Replicat uses a checkpoint table in the target database. This enables theReplicat checkpoint to be included within the Replicat transaction itself, toensure that a transaction will only be applied once, even if there is a failureof the Replicat process or the database process. Thecheckpoint table remains small because rows are deleted when no longer needed, andit does not affect database performance.
--Checkpoint 保留了很少的記錄,對于哪些很長時間內不需要的的數據會自動刪除,所以checkpoint 不會對數據庫造成性能上的影響。
?
?
GoldenGate的檢查點信息有兩種存放方式:
1.?????存放在GGHOME\dirchk下的文件中。
這種是默認的方法,一個進程對應一個文件。提取進程可以只使用這種模式。不需要checkpoint table。 但是這種方式在db recovery 之后可能出現數據不一致。
?
gg2:/u01/backup> cd /u01/ggate/dirchk
gg2:/u01/ggate/dirchk> ls
REP1.cpr? REPT2.cpr
?
2.?????存放在數據庫指定的表中,需要單獨配置。
?
配置步驟如下:
(1)在./GLOBALS文件里添加checkpoint 表名
CHECKPOINTTABLE [<owner>.<table>]? ?--指定的檢查點記錄表
(2)連上DB,創建checkpoint 表
GGSCI> DBLOGIN [SOURCEDB <dsn>][,USERID <db_user>[, PASSWORD <pw>]]
GGSCI> ADD CHECKPOINTTABLE [<owner>.<table>] ??--生成這個檢查點記錄表
(3)在新增復制進程時可以在添加時指定checkpointtable[<owner>.<table>] 替代nodbcheckpoint,使用數據庫記錄檢查點信息。
?
二.示例
2.1???配置./GLOBALS 參數
GGSCI (gg2) 65> view params ./GLOBALS
?
GGSCHEMA ggate
CHECKPOINTTABLE ggate.checkpoint
?
當我們在GLOBALS 文件里指定了默認的checkpoint 之后,新的Replicat groups 在創建時會自動使用這個參數,不需要其他指令。
?
2.2 連上數據庫,創建checkpoint表
?
GGSCI (gg2) 58> dblogin useridggate@gg2,password ggate
Successfully logged into database.
?
GGSCI (gg2) 59> add checkpointtableggate.checkpoint
Successfully created checkpoint tableGGATE.CHECKPOINT.
?
2.3 在創建Replicat進程時,指定checkpoint 表
GGSCI (gg2) 14> add replicatrep1,exttrail /u01/ggate/dirdat/lt, checkpointtable ggate.checkpoint
REPLICAT added.
?
至此,Checkpoint 的配置就完成。 我們查看一下checkpoint 表。
?
SQL> conn ggate/ggate
deConnected.
SQL> desc checkpoint
?Name?????????????????????????????????????Null???? Type
?------------------------------------------------- ----------------------------
?GROUP_NAME??????????????????????????????? NOT NULLVARCHAR2(8)
?GROUP_KEY???????????????????????????????? NOT NULLNUMBER(19)
?SEQNO?????????????????????????????????????????????NUMBER(10)
?RBA?????????????????????????????????????? NOT NULLNUMBER(19)
?AUDIT_TS??????????????????????????????????????????VARCHAR2(29)
?CREATE_TS???????????????????????????????? NOT NULL DATE
?LAST_UPDATE_TS??????????????????????????? NOT NULL DATE
?CURRENT_DIR?????????????????????????????? NOT NULLVARCHAR2(255)
?
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
?
?
?
?
?
?
-------------------------------------------------------------------------------------------------------
版權所有,文章允許轉載,但必須以鏈接方式注明源地址,否則追究法律責任!
Blog:???? http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Email: ? tianlesoftware@gmail.com
Skype: tianlesoftware
?
-------加群需要在備注說明Oracle表空間和數據文件的關系,否則拒絕申請----
DBA1 群:62697716(滿);?? DBA2 群:62697977(滿)??DBA3 群:62697850(滿)??
DBA 超級群:63306533(滿);? DBA4 群:83829929(滿) DBA5群: 142216823(滿)?
DBA6 群:158654907(滿)?? DBA7 群:69087192(滿)??DBA8 群:172855474
DBA 超級群2:151508914? DBA9群:102954821???? 聊天 群:40132017(滿)
轉載于:https://www.cnblogs.com/zlja/archive/2011/11/17/2449537.html
總結
以上是生活随笔為你收集整理的Oracle Golden Gate 系列十三 -- 配置GG进程检查点(checkpoint) 说明的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++内存管理——指针数组
- 下一篇: Servlet - cookie、ses