Skip to main content

Determining DB2 Logs for Purge via Snapshot Metadata (KBA4013)




KBA# 4013

DB2 Logs Which Can be Purged via Snapshot

With the Delphix Recovery with backups and Logs feature of DB2 Plugin, you can apply the archive logs to update the dSource. Purging of logs will be handled after completion of log apply (DB_SYNC or snapshot operation) operation.

Eligible Logs for Purge

There are two ways to get the list of logs which are eligible for purge.

Using CLI 

  1. Login on Delphix Engine CLI with management user credentials.

  2. Navigate to Snapshot.
    For example :

de-sample> snapshot

de-sample snapshot> select '@2019-04-21T03:30:23.601'  # Select the latest snapshot

de-sample snapshot ''@2019-04-21T03:30:23.601''> get metadata  # You’ll get the metadata of snapshot

  1. The above step will give you the snapshot metadata and the field listLogPurge will provide the list of logs eligible for purging.

Using API

  1. Make a connection to the Delphix Engine.

$ curl -s -c cookies.txt -X POST -H "Content-Type:application/json" http://$de/resources/json/delphix/session -d '{"version":{"minor":10, "major":1, "micro": 0, "type":"APIVersion"}, "type":"APISession"}'
$ curl -s -c cookies.txt -b cookies.txt -X POST -H "Content-Type:application/json" http://$de/resources/json/delphix/login -d "{\"password\":"\"$pass\"",\"type\":\"LoginRequest\",\"target\":\"DOMAIN\",\"username\":\"$uname\"}"
  1. Query the snapshot API.
$ curl -s -b cookies.txt -X GET -H Content-Type:application/json
http://$de/resources/json/delphix/snapshot | jq '.result[].metadata | select(.dbName == "$databasename") | .timestamp + "|" + .dbName + "|" + .listLogPurge'


$de is DE name

$uname is DE username

$pass is DE password

$databasename is dSource database name

  1. Find field listLogPurge, it’ll provide the list of logs which are eligible for purging. Once list will be obtained by the user then the user can proceed further to remove the listed logs.

Automate Purging of Logs

To automate the purging of logs

  1. Create a bash script on your staging host with content which will obtain the list of logs which are eligible for purging.
    The bash script must have the ability to execute commands on Delphix Engine host remotely, which means that you will have to provide the login credentials in bash script.

  2. Execute the bash script using Post Sync Hook of Delphix Engine.

listLogPurge Attribute

This is an example to show actual Metadata store listLogPurge format.