Goldengate MANAGER process PURGEOLDEXTRACTS is not purging old trail files

Extract process generating local trail files and  PUMP process reading them and generating remote trail files could consume significant amount disk space if they are purged on regular basis.

GoldenGate Manager process can be configured with PURGEOLDEXTRACTS  parameter to automatically cleanup the trail files after being processed by all the processes. When PURGEOLDEXTRACTS  is used, USECHECKPOINTS is default, where Manager process use checkpoints of the processes reading the trail files to purge them. MINKEEP_rule can be used in combination with USECHECKPOINTS  to keep the trail files even after being processed.

For Example:

PURGEOLDEXTRACTS /app/goldengate/data/exttrail/db1/schema1/aa, USECHECKPOINTS, MINKEEPHOURS 2
PURGEOLDEXTRACTS /app/goldengate/data/rmttrail/db1/schema1/aa, USECHECKPOINTS, MINKEEPDAY 2
PURGEOLDEXTRACTS /app/goldengate/data/exttrail/db2/schema1/aa, USECHECKPOINTS, MINKEEPFILES 2

Sometimes it could happen that the trail files not being purged even after configuring PURGEOLDEXTRACTS parameter in the Manager parameter file. Below are some of the possible reasons that why PURGEOLDEXTRACTS parameter in MANAGER process is not working.

1. Manager process does not purge trail files by default. Make sure you have proper trail file specified in the PURGEOLDEXTRACTS parameter and restart the MANAGER process.

GGSCI > view params mgr
PORT 7849
PURGEOLDEXTRACTS /app/goldengate/data/exttrail/testdb/mf*, USECHECKPOINTS, MINKEEPDAYS 5

2. Make sure the MANAGER process is running as user that have privilege to delete trail files. If not stop it and restart with appropriate user.

GGSCI > sh ps -ef | grep mgr

3. Identify the processes that are using the trail files and check they are all current and running without lag. If any of the process reading those trail files is not current, the MANAGER process will not purge trail files until they are processed.

GGSCI 1> sh date
Fri Sep 23 11:39:08 EDT 2016

GGSCI 2> info RSTESTDB
REPLICAT RSTESTDB Last Started 2016-09-12 14:54 Status RUNNING
Checkpoint Lag 23:21:52 (updated 00:00:51 ago)
Process ID 12187
Log Read Checkpoint File /app/goldengate/data/rmttrail/testdb/mf006803
 2016-09-21 12:00:59.752202 RBA 24909084

4. Delete any obsolete processes that are configured with the trail files.

GGSCI 1> sh date
Fri Sep 23 11:39:08 EDT 2016

GGSCI 5> info RNFSDD 
REPLICAT RNFSDD Last Started 2016-09-11 00:40 Status ABENDED 
Checkpoint Lag 00:00:00 (updated 1810:37:04 ago) 
Log Read Checkpoint File /app/goldengate/data/rmttrail/testdb/mf005034
2016-09-18 01:00:03.123202 RBA 2479297

5. Check if  MINKEEP_rules are met.

MINKEEPDAYS | MINKEEPHOURS | MINKEEPFILES

6. It could be a bug.

OGG 12.2 has a bug when coming to purging old trail files where if multiple PURGEOLDEXTRACTS are defined, only the first one will be satisfied.

GoldenGate Manager (MGR) Not Cleaning Up Trail Files When PURGEOLDEXTRACTS Defined Twice Or More (Doc ID 2149579.1)

In this case if multiple PURGEOLDEXTRACTS are defined, only the first one will be satisfied.

As a workaround solution, set only one PURGEOLDEXTRACTS entry at a higher directory level that will cover all the sub-directories below it.

For example, for below entires

PURGEOLDEXTRACTS /app/goldengate/data/exttrail/db1/schema1/aa, USECHECKPOINTS, MINKEEPHOURS 2
PURGEOLDEXTRACTS /app/goldengate/data/exttrail/db2/schema1/*,  USECHECKPOINTS, MINKEEPHOURS 2

Try,

PURGEOLDEXTRACTS /app/goldengate/data/exttrail/*, USECHECKPOINTS, MINKEEPHOURS 2

#abended, #extract, #exttrail, #exttrail-purge, #files, #goldengate, #goldengate-trail-files-not-purging, #lag, #manager, #manager-not-purging, #manager-not-working, #minkeep, #minkeepdays, #minkeepfiles, #minkeephours, #minkeep_rules, #old, #oracle, #oracle-goldengate, #prodduturi, #pump, #purgeoldextracts, #reddy-prodduturi, #replicat, #rmttrail, #rmttrail-files, #rmttrail-purge, #running, #stopped, #viswaketan, #viswaketan-reddy-prodduturi