As we all know, OGG does not delete the trail files when you delete your Extract or Replicat groups.
In OGG OCI which is managed by Oracle and users don’t necessarily have backend access, and if we delete the ER groups I would consider best practices to go ahead and delete those trails as well.
To do that you can use the curl “commands execute” call for that, here is an example I have used:
alexlima@alexlima-mac LABS % cat purge_migration_trails.sh
curl -K /Users/alexlima/Documents/LABS/access.cfg \
-X POST https://w5mi5ndrjtqasbr.deployment.goldengate.us-ashburn-1.oci.oraclecloud.com/services/v2/commands/execute \
-H 'Content-Type: application/json' \
-d \
'{
"name": "purge",
"purgeType": "trails",
"trails": [
{
"name": "e1"
}
],
"useCheckpoints": false,
"keep": [
{
"type": "min",
"units": "files",
"value": 0
}
]
}' | python -m json.tool
Here is the output:
"messages": [
{
"$schema": "ogg:message",
"code": "OGG-00957",
"issued": "2021-11-22T01:59:51Z",
"severity": "INFO",
"title": "Purged old extract file '/u02/Deployment/var/lib/data/e1000000000'. Purge rule: Purging all files for trail '/u02/Deployment/var/lib/data/e1'.",
"type": "http://docs.oracle.com/goldengate/c2140/gg-winux/GMESG/oggus.htm#OGG-00957"
},
{
"$schema": "ogg:message",
"code": "OGG-00957",
"issued": "2021-11-22T01:59:51Z",
"severity": "INFO",
"title": "Purged old extract file '/u02/Deployment/var/lib/data/e1000000001'. Purge rule: Purging all files for trail '/u02/Deployment/var/lib/data/e1'.",
"type": "http://docs.oracle.com/goldengate/c2140/gg-winux/GMESG/oggus.htm#OGG-00957"
},
{
"$schema": "ogg:message",
"code": "OGG-00957",
"issued": "2021-11-22T01:59:51Z",
"severity": "INFO",
"title": "Purged old extract file '/u02/Deployment/var/lib/data/e1000000002'. Purge rule: Purging all files for trail '/u02/Deployment/var/lib/data/e1'.",
"type": "http://docs.oracle.com/goldengate/c2140/gg-winux/GMESG/oggus.htm#OGG-00957"
},
{
"$schema": "ogg:message",
"code": "OGG-00957",
"issued": "2021-11-22T01:59:51Z",
"severity": "INFO",
"title": "Purged old extract file '/u02/Deployment/var/lib/data/e1000000003'. Purge rule: Purging all files for trail '/u02/Deployment/var/lib/data/e1'.",
"type": "http://docs.oracle.com/goldengate/c2140/gg-winux/GMESG/oggus.htm#OGG-00957"
}
]

Reference: