百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 优雅编程 > 正文

白话了解 Oracle GoldenGate Trail 原理(译)

sinye56 2024-10-12 10:53 8 浏览 0 评论

Trail文件介绍

To support the continuous extraction and replication of database changes, Oracle GoldenGate stores records of the captured changes temporarily on disk in a series of files called a trail. A trail can exist on the source system, an intermediary system, the target system, or any combination of those systems, depending on how you configure Oracle GoldenGate. On the local system it is known as an extract trail (or local trail). On a remote system it is known as a remote trail.

By using a trail for storage, Oracle GoldenGate supports data accuracy and fault tolerance (see Overview of Checkpoints). The use of a trail also allows extraction and replication activities to occur independently of each other. With these processes separated, you have more choices for how data is processed and delivered. For example, instead of extracting and replicating changes continuously, you could extract changes continuously but store them in the trail for replication to the target later, whenever the target application needs them.

为了更有效、更安全的把数据库事务信息从源端投递到目标端。GoldenGate引进trail文件的概念。前面提到extract抽取完数据以后Goldengate会将抽取的事务信息转化为一种GoldenGate专有格式的文件。然后pump负责把源端的trail文件投递到目标端,所以源、 目标两端都会存在这种文件。

Trail文件存在的目的旨在防止单点故障,将事务信息持久化,并且使用checkpoint机制来记录其读写位置,如果故障发生,则数据可以根据checkpoint记录的位置来重传。当然,也可以通过extract通过TCP/IP协议直接发送到目标端,生成远程trail文件,但这种方式可能造成数据丢失。

Trail文件默认为10MB,以两个字符开始加上000000~999999的数字作为文件名。如c:\directory/tr000001.默认情况下存储在GoldenGatedirdat子目录中。可以为不同应用或者对象创建不同的trail文件。同一时刻,只会有一个extract进程处理一个trail文件。10.0版本以后的GoldenGate,会在trail文件头部存储包含trail文件信息的记录,而10.0之前的版本不会存储该信息。每个trail文件中的数据记录包含了数据头区域和数据区域。在 数据头区域中包含事务信息,数据区域包含实际抽取的数据


Trail文件写入与读取的过程

The primary Extract and the data-pump Extract write to a trail. Every online Extract process must be linked to a trail. Only one primary Extract process can write to a given local trail. All local trails must have different names.

Multiple data pump Extract processes can each write to a trail of the same name, but the physical trails themselves must reside on different remote systems, such as in a data-distribution topology. For example, a data pump named 1pump and a data pump named 2pump can both reside on sys01 and write to a remote trail named aa. Data pump 1pump can write to trail aa on sys02, while data pump 2pump can write to trail aa on sys03.

Processes that read the trail are:

? Data-pump Extract: Extracts DML and DDL operations from a local trail that is linked to a previous Extract (typically the primary Extract), performs further processing if needed, and transfers the data to a trail that is read by the next Oracle GoldenGate process downstream (typically Replicat, but could be another data pump if required).

? Replicat: Reads the trail and applies replicated DML and DDL operations to the target database.

主Extract进程和data-pump Extract进程会把数据写入到一个trail文件。每一个在线的Extract进程都链接这一个trail文件。只有主Extract进程可以写入到一个指定的local trail文件中。所有的local trail文件必须有不同的名称。 多个data-pump Extract进程每一个都可以写入到一个相同名称的trail文件中,但是这些trail文件的物理结构是在不同的远程端的,其意思是数据物理分布的拓扑结构。例如,一个data-pump进程命名为1pump和一个data-pump进程命名为2pump同事驻留在sys01源端上,并写入一个remote trail文件,命名为aa。其中1pump写入的aa在sys02远程端上,2pump写入的aa在sys03远程端上。 读取trail文件的线程是:

  • Data-pump Extract进程:是从local trail文件中抽取DML和DDl的操作记录。这个local trail文件链接着一个之前的Extract进程(一般是主Extract进程),如果需要下一步操作。就需把数据传送到一个trail文件中,这个trail文件将由下一个Oracle GoldenGate进程读取(一般是Relicat进程,但也可能是另外一个Data-pump进程)
  • Replicat进程:读取trail文件,并应用已经复制过来的DML和DDl操作到目标数据库中。

Trail文件的生成与维护

The trail files themselves are created as needed during processing, but you specify a two-character name for the trail when you add it to the Oracle GoldenGate configuration with the ADD RMTTRAIL or ADD EXTTRAIL command. By default, trails are stored in the dirdat sub-directory of the Oracle GoldenGate directory. You can specify a six or nine digit sequence number using the TRAIL_SEQLEN_9D | TRAIL_SEQLEN_6D GLOBALS parameter; TRAIL_SEQLEN_9D is set by default.

Trail files are aged automatically to allow processing to continue without interruption for file maintenance. As each new file is created, it inherits the two-character trail name appended with a unique nine digit sequence number from 000000000 through 999999999 (for example c:\ggs\dirdat\tr000000001). When the sequence number reaches 999999999, the numbering starts over at 000000000, and previous trail files are overwritten. Trail files can be purged on a routine basis by using the Manager parameter PURGEOLDEXTRACTS. The 9 digits trail file format is the default.

You can create more than one trail to separate the data from different objects or applications. You link the objects that are specified in a TABLE or SEQUENCE parameter to a trail that is specified with an EXTTRAIL or RMTTRAIL parameter in the Extract parameter file.

To maximize throughput, and to minimize I/O load on the system, extracted data is sent into and out of a trail in large blocks. Transactional order is preserved.

See About the Oracle GoldenGate Trail for more information about the trail and the records it contains.

Trail文件本身会在进程中自动生成,但是你需要为trail文件制定一个以两个字符命名的名字。当你配置Oracle GoldenGate的时候,可以通过ADD RMTTRAIL 和 ADD EXTTRAIL命令进行配置。默认情况下,trail文件存储在Oracle GlodenGate目录下的dirdat子目录中。你可以制定一个6位还是9位的序列号,通过配置全局参数TRAIL_SEQLEN_9D | TRAIL_SEQLEN_6D。

默认是TRAIL_SEQLEN_9D全局参数。

Trail文件会自动老化,并且允许进程可以在不打断的情况下维护这些Trail文件。每一个新文件的生成,它会继承一个以两个字符+6位或者9位的独一的一个序列号。(例如c:\ggs\dirdat\tr000001)。当序列号达到999999的时候,它又会从000000编号开始。Trail文件可以通过PURGEOLDEXTRACTS这个管理参数进行清除。 你可以创建一个以上的trail文件,用于分离来自于不同的对象或者不用的应用的数据。你连接的对象可以通过配置TABLE 或者SEQUENCE 参数来制定,对应的trail文件可以通过EXTTRAIL 和 RMTTRAIL参数来制定。 为了最大限度地提高吞吐量,并最大限度地减少系统上的I / O负载。提取的数据被发送到一个trail文件可以使用大块操作。交易的顺序会被保留。

Trail文件升级到9位序列号

You can convert trail files from 9 digit to 6 digit checkpoint record for the named extract groups. Use convchk native command to convert to 9 digit trail by stopping your Extract gracefully then using convchk to upgrade as follows:

convchk extract trail seqlen_9d

Start your Extract.

You can downgrade from a 9 to 6 digit trail with the same process using this convchk command:

convchk extract trail seqlen_6d

可以升级现在的trail文件从6位序列号到9位序列号。使用convchk本地命令可以升级到一个9位的trail文件。通过停止Extract进程然后使用如下命令:

convchk extract trail seqlen_9d

启动Etract进程

你也可以降级从9位到6位序列号,用如下命令:

convchk extract trail seqlen_6d

将配置再全局变量中:

edit params ./GLOBALS

TRAIL_SEQLEN_9D --转换为9位

TRAIL_SEQLEN_6D --转换为6位

相关推荐

程序员:JDK的安装与配置(完整版)_jdk的安装方法

对于Java程序员来说,jdk是必不陌生的一个词。但怎么安装配置jdk,对新手来说确实头疼的一件事情。我这里以jdk10为例,详细的说明讲解了jdk的安装和配置,如果有不明白的小伙伴可以评论区留言哦下...

Linux中安装jdk并配置环境变量_linux jdk安装教程及环境变量配置

一、通过连接工具登录到Linux(我这里使用的Centos7.6版本)服务器连接工具有很多我就不一一介绍了今天使用比较常用的XShell工具登录成功如下:二、上传jdk安装包到Linux服务器jdk...

麒麟系统安装JAVA JDK教程_麒麟系统配置jdk

检查检查系统是否自带java在麒麟系统桌面空白处,右键“在终端打开”,打开shell对话框输入:java–version查看是否自带java及版本如图所示,系统自带OpenJDK,要先卸载自带JDK...

学习笔记-Linux JDK - 安装&配置

前提条件#检查是否存在JDKrpm-qa|grepjava#删除现存JDKyum-yremovejava*安装OracleJDK不分系统#进入安装文件目...

Linux新手入门系列:Linux下jdk安装配置

本系列文章是把作者刚接触和学习Linux时候的实操记录分享出来,内容主要包括Linux入门的一些理论概念知识、Web程序、mysql数据库的简单安装部署,希望能够帮到一些初学者,少走一些弯路。注意:L...

测试员必备:Linux下安装JDK 1.8你必须知道的那些事

1.简介在Oracle收购Sun后,Java的一系列产品就被整合到Oracle官网中,打开官网乍眼一看也不知道去哪里下载,还得一个一个的摸索尝试,而且网上大多数都是一些Oracle收购Sun前,或者就...

Linux 下安装JDK17_linux 安装jdk1.8 yum

一、安装环境操作系统:JDK版本:17二、安装步骤第一步:下载安装包下载Linux环境下的jdk1.8,请去官网(https://www.oracle.com/java/technologies/do...

在Ubuntu系统中安装JDK 17并配置环境变量教程

在Ubuntu系统上安装JDK17并配置环境变量是Java开发环境搭建的重要步骤。JDK17是Oracle提供的长期支持版本,广泛用于开发Java应用程序。以下是详细的步骤,帮助你在Ubuntu系...

如何在 Linux 上安装 Java_linux安装java的步骤

在桌面上拥抱Java应用程序,然后在所有桌面上运行它们。--SethKenlon(作者)无论你运行的是哪种操作系统,通常都有几种安装应用程序的方法。有时你可能会在应用程序商店中找到一个应用程序...

Windows和Linux环境下的JDK安装教程

JavaDevelopmentKit(简称JDK),是Java开发的核心工具包,提供了Java应用程序的编译、运行和开发所需的各类工具和类库。它包括了JRE(JavaRuntimeEnviro...

linux安装jdk_linux安装jdk软连接

JDK是啥就不用多介绍了哈,外行的人也不会进来看我的博文。依然记得读大学那会,第一次实验课就是在机房安装jdk,编写HelloWorld程序。时光飞逝啊,一下过了十多年了,挣了不少钱,买了跑车,娶了富...

linux安装jdk,全局配置,不同用户不同jdk

jdk1.8安装包链接:https://pan.baidu.com/s/14qBrh6ZpLK04QS8ogCepwg提取码:09zs上传文件解压tar-zxvfjdk-8u152-linux-...

运维大神教你在linux下安装jdk8_linux安装jdk1.7

1.到官网下载适合自己机器的版本。楼主下载的是jdk-8u66-linux-i586.tar.gzhttp://www.oracle.com/technetwork/java/javase/downl...

window和linux安装JDK1.8_linux 安装jdk1.8.tar

Windows安装JDK1.8的步骤:步骤1:下载JDK打开浏览器,找到JDK下载页面https://d.injdk.cn/download/oraclejdk/8在页面中找到并点击“下载...

最全的linux下安装JavaJDK的教程(图文详解)不会安装你来打我?

默认已经有了linux服务器,且有root账号首先检查一下是否已经安装过java的jdk任意位置输入命令:whichjava像我这个已经安装过了,就会提示在哪个位置,你的肯定是找不到。一般我们在...

取消回复欢迎 发表评论: