使用PURGEOLDEXTRACTS设置goldengate自动清除trail file

本文详细介绍了 Oracle GoldenGate 中 PURGEOLDEXTRACTS 参数的配置方法及注意事项,包括如何设置以避免 trail 文件占用过多磁盘空间,以及如何通过不同规则组合来实现高效的数据清理。
摘要由CSDN通过智能技术生成

如果不设置PURGEOLDEXTRACTS参数trail file不会自动被删除将占用大量的空间,空间沾满goldengatehang,影响复制。PURGEOLDEXTRACTS参数可以被设置在Manager, Extract, and Replicat参数文件中,oracle建议设置在Manager中。

以下仅介绍在Manager参数文件中的设置

1 语法

Syntax PURGEOLDEXTRACTS

[, USECHECKPOINTS | NOUSECHECKPOINTS]

[, ]

[, ]

2 解释

Argument Description

The trail to purge. Use the fully qualified name.

USECHECKPOINTS Allows purging after all Extract and Replicat processes are done with

the data as indicated by checkpoints, according to any MINKEEP rules.

NOUSECHECKPOINTS Allows purging without considering checkpoints, based on keeping a

minimum of either:

one file if no MINKEEP rule is used

or...

the number of files specified with a MINKEEP rule.

Can be one of the following to set rules for the minimum amount of time

to keep data.

MINKEEPHOURS

Keeps an unmodified file for at least the specified number of hours.

MINKEEPDAYS

Keeps an unmodified file for at least the specified number of days.

MINKEEPFILES

Keeps at least unmodified trail files, including the active file.

Sets the frequency with which to purge old trail files. The default time

for Manager to process maintenance tasks is 10 minutes, as specified

with the CHECKMINUTES parameter (see page 137). Every 10 minutes,

Manager evaluates the PURGEOLDEXTRACTS frequency and conducts the

purge after the specified interval. can be one of the following:

FREQUENCYMINUTES

Sets the frequency, in minutes, with which to purge old trail files. The

default purge frequency is 60 minutes.

FREQUENCYHOURS

Sets the frequency, in hours, at which to purge old trail files.

frequency设置清楚old trail files.间隔时间默认值是CHECKMINUTES

3 控制规则

  3.1 USECHECKPOINTS 规则

管理进程清楚这些被CHECKPOINTS表明已经被所有进程检测过的文件, 保证数据不丢失,USECHECKPOINTS是默认设置, NOUSECHECKPOINTS参数取消该检测,生产环境建议设置USECHECKPOINTS

  3.2 MINKEEP规则

该规则设置最小保存时间或文件数,

最小时间参数:MINKEEPHOURS, MINKEEPDAYS

最小文件数参数:MINKEEPFILES

如果时间和文件同时设置, MINKEEPHOURS, MINKEEPDAYS优先级高于MINKEEPFILES, MINKEEPFILES将被忽略

 3.3 两种规则的组合使用

1 只有USECHECKPOINTS

如果CHECKPOINTS表明都被完成,只保留一个文件

2 USECHECKPOINTS+MINKEEP

两个功能同时生效

3 只有NOUSECHECKPOINTS

默认只保留一个文件

4 NOUSECHECKPOINTS+MINKEEP

按照MINKEEP规则执行忽略CHECKPOINTS效验

 

常用设置

PURGEOLDEXTRACTS /ggs/dirdat/AA*, USECHECKPOINTS, MINKEEPDAYS 2

 

 

 

4 示例


[oraogg@ylptnode1 ggate]$ ls -l /u01/ggate/dirdat/lt*

-rw-rw-rw- 1 oraogg oinstall 9999887 Oct 29 10:32 /u01/ggate/dirdat/lt000000

-rw-rw-rw- 1 oraogg oinstall 9999747 Oct 29 17:01 /u01/ggate/dirdat/lt000001

-rw-rw-rw- 1 oraogg oinstall 9999836 Oct 29 17:01 /u01/ggate/dirdat/lt000002

-rw-rw-rw- 1 oraogg oinstall 9999892 Oct 29 17:01 /u01/ggate/dirdat/lt000003

-rw-rw-rw- 1 oraogg oinstall 9999701 Oct 30 16:03 /u01/ggate/dirdat/lt000004

-rw-rw-rw- 1 oraogg oinstall 8810570 Oct 30 16:03 /u01/ggate/dirdat/lt000005

 

/u01/ggate/dirdat/lt:

total 0

[oraogg@ylptnode1 ggate]$ ./ggsci

 

Oracle GoldenGate Command Interpreter for Oracle

Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100

Linux, x86, 32bit (optimized), Oracle 10g on Oct  4 2011 23:54:04

 

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.

 

 

 

Source

 

GGSCI (ylptnode1) 1> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     STOPPED                                          

EXTRACT     RUNNING     DPUMP       00:00:00      00:00:06   

EXTRACT     RUNNING     EXT1        00:00:00      00:00:04   

 

 

GGSCI (ylptnode1) 2> stop manager

Manager is already stopped.

 

 

GGSCI (ylptnode1) 3> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     STOPPED                                          

EXTRACT     RUNNING     DPUMP       00:00:00      00:00:07   

EXTRACT     RUNNING     EXT1        00:00:00      00:00:05   

 

 

GGSCI (ylptnode1) 4> edit params mgr

 

 

PORT 7809

PURGEOLDEXTRACTS /u01/ggate/dirdat/lt*, USECHECKPOINTS, MINKEEPHOURS 2

~                                                                                                                                                                                

~                                                                                                                                                                               

                                                                                                                                                                      

                                                                                                                                                                      

~                                                                                                                                                                               

~                                                                                                                                                                                

~                                                                                                                                                                                

~                                                                                                                                                                                                                                                                                                                                   

"dirprm/mgr.prm" 2L, 81C written

 

 

GGSCI (ylptnode1) 5>

 

GGSCI (ylptnode1) 5> start manager

 

Manager started.

 

 

GGSCI (ylptnode1) 6> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     RUNNING                                          

EXTRACT     RUNNING     DPUMP       00:00:00      00:00:08   

EXTRACT     RUNNING     EXT1        00:00:00      00:00:04   

 

 

GGSCI (ylptnode1) 7> exit

[oraogg@ylptnode1 ggate]$ ls -l /u01/ggate/dirdat/lt*

-rw-rw-rw- 1 oraogg oinstall 8810570 Oct 30 16:03 /u01/ggate/dirdat/lt000005

[oraogg@ylptnode1 ggate]$ date

Thu Oct 31 16:30:07 CST 2013

 

Target

 

[oraogg@ylptnode2 ggate]$ ls -l /u01/ggate/dirdat/lt*

-rw-rw-rw- 1 oraogg oinstall 9999921 Oct 29 10:32 /u01/ggate/dirdat/lt000000

-rw-rw-rw- 1 oraogg oinstall 9999781 Oct 29 17:01 /u01/ggate/dirdat/lt000001

-rw-rw-rw- 1 oraogg oinstall 9999870 Oct 29 17:01 /u01/ggate/dirdat/lt000002

-rw-rw-rw- 1 oraogg oinstall 9999926 Oct 29 17:01 /u01/ggate/dirdat/lt000003

-rw-rw-rw- 1 oraogg oinstall 9999735 Oct 30 16:03 /u01/ggate/dirdat/lt000004

-rw-rw-rw- 1 oraogg oinstall 8810604 Oct 30 16:03 /u01/ggate/dirdat/lt000005

 

/u01/ggate/dirdat/lt:

total 0

[oraogg@ylptnode2 ggate]$ ./ggsci

 

Oracle GoldenGate Command Interpreter for Oracle

Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100

Linux, x86, 32bit (optimized), Oracle 10g on Oct  4 2011 23:54:04

 

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.

 

 

 

GGSCI (ylptnode2) 1> STOP MANAGER

Manager process is required by other GGS processes.

Are you sure you want to stop it (y/n)? Y

 

Sending STOP request to MANAGER ...

Request processed.

Manager stopped.

 

 

GGSCI (ylptnode2) 2> edit params mgr

 

 

 

 

 

PORT 7809

PURGEOLDEXTRACTS /u01/ggate/dirdat/lt*, USECHECKPOINTS, MINKEEPHOURS 2

~                                                                                                                                                                               

 

                                                                                                                                                                         

~                                                                                                                                                                                

~                                                                                                                                                                                

"dirprm/mgr.prm" 2L, 81C written

 

 

GGSCI (ylptnode2) 3> start manager

 

Manager started.

 

 

GGSCI (ylptnode2) 4> info all

 

Program     Status      Group       Lag           Time Since Chkpt

 

MANAGER     RUNNING                                          

REPLICAT    RUNNING     REP1        00:00:00      00:00:08   

 

 

GGSCI (ylptnode2) 5> exit

[oraogg@ylptnode2 ggate]$ ls -l /u01/ggate/dirdat/lt*

-rw-rw-rw- 1 oraogg oinstall 8810604 Oct 30 16:03 /u01/ggate/dirdat/lt000005

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15747463/viewspace-775433/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15747463/viewspace-775433/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值