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文件写入与读取的过程
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.
主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文件升级到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位