Oracle GoldenGate Trail文件

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. 默认情况下存储在 GoldenGate dirdat 子目录中。可以为不同应用或者对象创建不同的 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位


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值