关于Goldengate中的Checkpoint和Checkpoint Lag

本文详细介绍了Oracle GoldenGate中Checkpoint的作用,它是进程处理位置的记录,用于防止数据丢失和重复处理,确保数据同步。同时,文章探讨了Checkpoint Lag的概念,即最近检查点与源端数据生成时间的差距,解释了其计算方式和意义,并通过测试验证了Lag与源端时间的关系。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.概要
前段时间,一个朋友问我关于goldengate中的Lag的问题。因涉及到Lag的详细行程过程,而我一直觉得Lag就是: 本进程处理一条记录的时间点和前一个进程处理该记录时的时间点的差距,因为一般情况下都是目标端的REP进程出现LAG的机会比较大,平时也更加侧重于如何去诊断LAG和优化,所以当纠结一些详细原因的时候就卡住了(到底是不是当前处理时间和源库产生的时间)。那既然要更加明确Lag是怎么回事,就需要了解ogg的checkpoint和Lag的原理。以下是相关官方文档的说法:

Checkpoints  store the current read and write positions of a process to disk for recovery purposes. Checkpoints ensure that data changes that are marked for synchronization actually are captured by Extract and applied to the target by Replicat, and they prevent redundant processing. They provide fault tolerance by preventing the loss of data should the system, the network, or an Oracle GoldenGate process need to be restarted. For complex synchronization configurations, checkpoints enable multiple Extract or Replicat processes to read from the same set of trails. Checkpoints work with inter-process acknowledgments to prevent messages from being lost in the network. Oracle GoldenGate has a proprietary guaranteed-message delivery technology.(通过这一段,说明checkpoint是用于记录进程当前到底处理到哪个位置的,这个checkpoint是用于防止数据的丢失和重复应用的。)

Extract creates checkpoints for its positions in the data source and in the trail. Because  Extract only captures committed transactions, it must keep track of operations in all open transactions, in the event that any of them are committed. This requires Extract to record
a checkpoint where it is currently reading in a transaction log, plus the position of the start of the oldest open transaction, which can be in the current or any preceding log. To control the amount of transaction log that must be re-processed after an outage, Extract persists the current state and data of processing to disk at specific intervals, including the state and data (if any) of long-running transactions. If Extract stops after one of these intervals, it can recover from a position within the previous interval or at the last checkpoint, instead of having to return to the log position where the oldest open longrunning transaction first appeared. For more information, see the BR parameter in the Oracle GoldenGate Windows and UNIX Reference Guide.(本段也很明确的说了,extract进程仅抓取committed的事务。当有大事务的时候它周期性的将cache中未提交的达到一定大小的事务保存到本地磁盘方便进行bound recovery)

Replicat creates checkpoints for its position in the trail. Replicat stores its checkpoints in a checkpoint table in the target database to couple the commit of its transaction with its position in the trail file. The checkpoint table guarantees consistency after a database recovery by ensuring that a transaction will only be applied once, even if there is a failure of the Replicat process or the database proc
<think>好的,用户遇到了GoldenGate报错,具体是checkpoint表规格中目录名称缺失的错误。我需要先理解这个错误的原因。根据引用[1],之前的错误提示是关于语法不正确,可能参数名有误或者缺少必要部分。而当前错误明确指出目录名称缺失,也就是在指定checkpoint表的时候没有包含catalog name,也就是数据库的schema名称。 首先,用户可能在创建checkpoint表时使用的命令格式不正确。正确的语法应该是ADD CHECKPOINTTABLE <catalog name>.<table name>,例如ADD CHECKPOINTTABLE ggadmin.checkpoint。如果用户只写了表名而没有指定目录名,就会报这个错误。我需要确认这一点,并提醒用户检查命令是否正确。 另外,引用[2]提到共享库的问题,可能与环境变量或Oracle客户端的配置有关。虽然当前错误不直接相关,但用户的环境可能存在问题,比如没有正确设置ORACLE_HOME或LD_LIBRARY_PATH,导致GoldenGate无法找到所需的库文件。这部分可能也需要检查,但优先级较低,先解决checkpoint表的语法问题。 接下来,可能的解决方案包括:验证命令语法是否正确,确认用户是否有权限访问指定的schema,检查数据库连接配置是否正确,以及确保GoldenGate用户有足够的权限创建表。此外,如果用户之前没有创建schema,可能需要先创建。还要注意表名的大小写是否匹配,特别是如果数据库是大小写敏感的。 最后,可能需要指导用户如何正确执行命令,并提供示例。同时,提醒用户检查GoldenGate参数文件中是否有相关配置错误,以及查看详细的日志来进一步诊断问题。</think>关于GoldenGate报错"checkpoint table specification missing catalog name"的解决方法,请按以下步骤排查: 1. **检查CHECKPOINTTABLE语法规范** 正确格式应包含目录名(schema名)表名: ```sql ADD CHECKPOINTTABLE <schema_name>.<table_name> ``` 示例:`ADD CHECKPOINTTABLE ggadmin.gg_checkpoint`[^1] 2. **验证数据库用户权限** 确保GoldenGate数据库用户: - 具有CREATE TABLE权限 - 对指定schema有访问权限 - 拥有表空间配额 可通过SQL验证: ```sql SELECT * FROM dba_sys_privs WHERE grantee = 'GGUSER'; ``` 3. **检查数据库连接配置** 在GLOBALS参数文件中确认: ```properties CHECKPOINTTABLE ggadmin.gg_checkpoint ``` 4. **处理大小写敏感性问题** 对于Oracle 12c及以上版本,当使用PDB时: ```sql ADD CHECKPOINTTABLE "GGADMIN"."GG_CHECKPOINT" ``` 5. **环境变量配置** 确保正确配置Oracle客户端: ```bash export ORACLE_HOME=/u01/app/oracle/product/19.0.0/client export LD_LIBRARY_PATH=$ORACLE_HOME/lib ``` **补充说明**:该错误通常发生在以下场景: - 跨PDB容器操作时未指定完整对象路径 - 使用默认schema时未显式声明 - GoldenGate版本与数据库版本不兼容(建议使用18c以上版本)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值