Skip links

Manually purging trail files from OCI GoldenGate Service

curl plu goldengate

Oracle GoldenGate Service is Oracle’s cloud offering  to quickly use GoldenGate to move data within OCI as well as other clouds.  Now network connection and bandwidth has a bit to do with the speed of data being processed, but it a quick service over all.  

One thing that any GoldenGate Administrator has to get use to is the lack of access to the underlying host where GoldenGate is running.  As my friends, the PMs, have told me this is due to GoldenGate Service being a “SERVICE”.  This basically means you do not need or will get access to the underlying filesystem of GGS.  For many GoldenGate Administrators this will be frustrating from a troubleshooting aspect – How do you confirm or make sure that trail files are being written to or read from?   Well, the answer is in OCI GoldenGate Service, but that is not the point of this post.  

The item that needs to be discussed is how to clean up trail files in GGS?  Cleaning up trail files is important because they do take space and if you don’t have a task enabled to clean up trail files, then space will be consumed and eventually used up.  How do you take care of this issue then manually?  The answer is simple and what is built into Oracle GoldenGate and Oracle GoldenGate Service – REST APIs.

To purge a single set of trail files (all trail files) that begin with a specific name, the below code can be used in Microsoft Visual Studio Code (VSCode).  

@url = <url>

###

POST {{url}}/services/v2/commands/execute
Authorization: Basic Z2dhZG1pbjphbHRlY0dHUE9DYWRtaW4yMyE
Content-Type: text/plain

{
"name": "purge",
"purgeType": "trails",
"trails": [
{
"name": “AL"
}
],
"useCheckpoints": false,
"keep": [
{
"type": "min”,
"units": "files”,
"value": 0
}
]
}

###

In the above example code, we are removing all the trail files that being with “AL”.  If you want to remove more than one series of trail files, we can simply add more trail file names to the code as follows:

@url = <url>

###

POST {{url}}/services/v2/commands/execute
Authorization: Basic Z2dhZG1pbjphbHRlY0dHUE9DYWRtaW4yMyE
Content-Type: text/plain

{
"name": "purge",
"purgeType": "trails",
"trails": [
             {
                "name": “AL”
              },
              {
                 “name”:”AB”
              }
],
"useCheckpoints": false,
"keep": [
               {
                  "type": "min”,
                   "units": "files”,
                   "value": 0
               }
         ]
}

###

If you are curious how this would look in a written cURL command, the below would do the same thing:

curl --request POST \
--url <url>/services/v2/commands/execute \
--header 'authorization: Basic Z2dhZG1pbjphbHRlY0dHUE9DYWRtaW4yMyE' \
--header 'content-type: text/plain' \
--header 'user-agent: vscode-restclient' \
--data '{"name": "purge","purgeType": "trails","trails": [{"name": "AL"}],"useCheckpoints": false,"keep": [{"type": "min","units": "files","value": 0}]}'

Enjoy!

Leave a comment