Refresh a Self Service Container from a Template Snapshot to reduce refresh time

  • 0
  • 2
  • Article
  • Updated 5 months ago
  • (Edited)
By default Self Service Refreshes on a container will refresh the container database or databases to the latest point in time available. We have seen that some of these refreshes may take some time. In the Oracle case, all archivelogs created after the backup have to be applied.


Our clients have been requested a way to refresh a container to the point in time where the snapshot happened in the template, but unfortunately the snapshots are not visible on the template timeline.


Here we present a workaround to be able to see snapshots in the template timeline on the Self Service screen.


On this example, the template has only one datasource.

The solution is very simple and based on the fact that bookmarks on templates are always shared, never private. So what I did is just create a post sync hook on the source (the template), that every time we do a snapsync, it will create a bookmark in the template that will be visible for all Self Service users. The hook is very simple and I used DxToolkit for it:



So every time a snapsync runs, this post sync hook will create a bookmark on the template timeline called snapsync + date:



With this simple hook, all Self Service users will have visibility to all the snapsyncs that are running on the source.

If you are not familiar with DxToolkit you must check it out. It's available here: https://github.com/delphix/dxtoolkit


If you don't want to use the DxToolkit script, as you will have to put it in all the targets, we can use a script like the one I pasted below. The good news about this approach is that all the logic to create the bookmark is stored in Delphix. This script has been tested in Red Hat Linux, may require minor changes for other Linux flavors or Unix.



On my example you can see delphix_admin is being used. If this is just not good enough in terms of security, we can just create a user with ownership on the dsource.



## This hook will create a bookmark in the template that contains this dsource

# Below Variables may change, make sure you have the proper values:
ENGINEURL=http://192.168.92.220
export URL
USR=delphix_admin
export USR
PASS=delphix
export PASS
BRANCHNAME=JS_BRANCH-1
export BRANCHNAME
SOURCEDATALAYOUT=JS_DATA_TEMPLATE-1
export SOURCEDATALAYOUT




#Below variables are fixed, no need to modify
BNAME=snapsyc-$(date +%Y-%m-%d-%H-%M-%S)
export BNAME




## Connect to the Delphix Engine
echo
echo
echo "Create session"
curl -s -X POST -k --data @- ${ENGINEURL}/resources/json/delphix/session \
    -c ~/cookies.txt -H "Content-Type: application/json" <
{
    "type": "APISession",
    "version": {
        "type": "APIVersion",
        "major": 1,
        "minor": 4,
        "micro": 0
    }
}
EOF
echo
echo
echo "Logon as:" ${USR}/${PASS}
curl -s -X POST -k --data @- ${ENGINEURL}/resources/json/delphix/login \
    -b ~/cookies.txt -H "Content-Type: application/json" <
{
    "type": "LoginRequest",
    "username": "${USR}",
    "password": "${PASS}"
}
EOF1




# Create Bookmark on Template
echo
echo
echo
echo
curl -s -X  POST -k --data @- ${ENGINEURL}/resources/json/delphix/jetstream/bookmark \
 -b ~/cookies.txt -H "Content-Type: application/json" <
{
    "type": "JSBookmarkCreateParameters",
    "bookmark": {
        "type": "JSBookmark",
        "name": "$BNAME",
        "branch": "$BRANCHNAME"
    },
    "timelinePointParameters": {
        "type": "JSTimelinePointLatestTimeInput",
        "sourceDataLayout": "$SOURCEDATALAYOUT"
    }
}
EOF1


Photo of Diego Loureda

Diego Loureda, Employee

  • 372 Points 250 badge 2x thumb

Posted 5 months ago

  • 0
  • 2

Be the first to post a reply!