|
一.Checkpoints 理論說明有關(guān)GG的Checkpoints 在系列一, GG的架構(gòu)中以說明: OracleGolden Gate 系列一 --GG 架構(gòu) 說明 http://blog.csdn.net/tianlesoftware/article/details/6925907
這里在單獨(dú)拿出來說明一下,因?yàn)檫@是一個(gè)較為重要的概念。
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 存儲(chǔ)了進(jìn)程當(dāng)前讀和寫的位置。 Checkpoints 保證已經(jīng)改變的數(shù)據(jù)已經(jīng)同步,從而阻止其他冗余的操作。 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 可以在以下情況下的數(shù)據(jù)丟失:系統(tǒng)或者網(wǎng)絡(luò)故障,重啟GG進(jìn)程。Checkpoints支持多個(gè)Extact 或者Replicat 進(jìn)程讀取同一個(gè)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. --默認(rèn)情況下Extract 和 Replicat 進(jìn)程都會(huì)在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 機(jī)制保證了Extract 和 Replicat 進(jìn)程可以連續(xù)的操作。
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 表里記錄了已經(jīng)提交了事務(wù)在trail 文件里的位置。這樣就可以保證事務(wù)只被應(yīng)用一次,即使在replicat 進(jìn)程或者DB 出現(xiàn)故障的情況下。 為了做報(bào)告,Replicat也會(huì)在GG 安裝目錄的dirchk 目錄里存放一個(gè)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 進(jìn)程使用這個(gè)本地的文件來存儲(chǔ)checkpoint,但是使用本地的checkpoint 文件, 在數(shù)據(jù)庫做了recover的情況下,不能保證數(shù)據(jù)的一致性。 在事務(wù)rolled back 或 rolledforward失敗的情況下,使用本地checkpoint 文件還是可以保證一致性。 而如果使用checkpoint table,在databaserecover 的情況下也可以保證數(shù)據(jù)的一致性。 所以推薦也是使用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 保留了很少的記錄,對于哪些很長時(shí)間內(nèi)不需要的的數(shù)據(jù)會(huì)自動(dòng)刪除,所以checkpoint 不會(huì)對數(shù)據(jù)庫造成性能上的影響。
GoldenGate的檢查點(diǎn)信息有兩種存放方式:1. 存放在GGHOME\dirchk下的文件中。 這種是默認(rèn)的方法,一個(gè)進(jìn)程對應(yīng)一個(gè)文件。提取進(jìn)程可以只使用這種模式。不需要checkpoint table。 但是這種方式在db recovery 之后可能出現(xiàn)數(shù)據(jù)不一致。
gg2:/u01/backup> cd /u01/ggate/dirchk gg2:/u01/ggate/dirchk> ls REP1.cpr REPT2.cpr
2. 存放在數(shù)據(jù)庫指定的表中,需要單獨(dú)配置。
配置步驟如下: (1)在./GLOBALS文件里添加checkpoint 表名 CHECKPOINTTABLE [<owner>.<table>] --指定的檢查點(diǎn)記錄表 (2)連上DB,創(chuàng)建checkpoint 表 GGSCI> DBLOGIN [SOURCEDB <dsn>][,USERID <db_user>[, PASSWORD <pw>]] GGSCI> ADD CHECKPOINTTABLE [<owner>.<table>] --生成這個(gè)檢查點(diǎn)記錄表 (3)在新增復(fù)制進(jìn)程時(shí)可以在添加時(shí)指定checkpointtable[<owner>.<table>] 替代nodbcheckpoint,使用數(shù)據(jù)庫記錄檢查點(diǎn)信息。
二.示例2.1 配置./GLOBALS 參數(shù) GGSCI (gg2) 65> view params ./GLOBALS
GGSCHEMA ggate CHECKPOINTTABLE ggate.checkpoint
當(dāng)我們在GLOBALS 文件里指定了默認(rèn)的checkpoint 之后,新的Replicat groups 在創(chuàng)建時(shí)會(huì)自動(dòng)使用這個(gè)參數(shù),不需要其他指令。
2.2 連上數(shù)據(jù)庫,創(chuàng)建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 在創(chuàng)建Replicat進(jìn)程時(shí),指定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
------------------------------------------------------------------------------------------------------- 版權(quán)所有,文章允許轉(zhuǎn)載,但必須以鏈接方式注明源地址,否則追究法律責(zé)任! Blog: http://blog.csdn.net/tianlesoftware Weibo: http://weibo.com/tianlesoftware Email: tianlesoftware@gmail.com Skype: tianlesoftware
-------加群需要在備注說明Oracle表空間和數(shù)據(jù)文件的關(guān)系,否則拒絕申請---- DBA1 群:62697716(滿); DBA2 群:62697977(滿) DBA3 群:62697850(滿) DBA 超級群:63306533(滿); DBA4 群:83829929(滿) DBA5群: 142216823(滿) DBA6 群:158654907(滿) DBA7 群:69087192(滿) DBA8 群:172855474 DBA 超級群2:151508914 DBA9群:102954821 聊天 群:40132017(滿) |
|
|