Skip to main content
Skip table of contents

API cookbook: rewind a VDB

This API cookbook recipe describes how to rewind a VDB using the Delphix Engine API.

To rewind a VDB, you need a reference to the Database object. See the topic, API Cookbook: List dSources and VDBs, for information on how to obtain the database reference. The following sample script includes a working example for creating a session, authenticating to the Delphix Engine, and rewinding the VDB. Please update the script variables to match your environment before using it.

CODE
#!/bin/bash
#
# sample script to start or stop a VDB.
#
# set this to the FQDN or IP address of the Delphix Engine
DE="192.168.2.131"
# set this to the Delphix admin user name
DELPHIX_ADMIN="delphix_admin"
# set this to the password for the Delphix admin user
DELPHIX_PASS="delphix"
# set this to the object reference for the VDB
VDB="ORACLE_DB_CONTAINER-57"
#
# create our session
$ curl -s -X POST -k --data @- http://delphix-server/resources/json/delphix/session \

   -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
   "type": "APISession",
   "version": {
       "type": "APIVersion",
       "major": 1,
       "minor": 4,
       "micro": 3
   }
}
EOF
{
   "status":"OK",
   "result": {
       "type":"APISession",
       "version": {
           "type": "APIVersion",
           "major": 1,
           "minor": 4,
           "micro": 3
       },
       "locale": "en_US",
       "client": null
   },
   "job": null
}
EOF
echo
#
# authenticate to the DE
$ curl -s -X POST -k --data @- http://delphix-server/resources/json/delphix/login \
   -b ~/cookies.txt -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
   "type": "LoginRequest",
   "username": "delphix_username",
   "password": "delphix_password"
}

EOF
echo
#
# rewind VDB
curl -s -X POST -k --data @- http://${DE}/resources/json/delphix/database/${VDB}/rollback \
    -b ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
    "type": "OracleRollbackParameters",
    "timeflowPointParameters": {
    "type" : "TimeflowPointSnapshot",
    "snapshot" : "ORACLE_SNAPSHOT-172"
    }
}
EOF
echo

While rewinding a VDB, you can use different parameter types. In the above example, "timeflowPointParameters" type is used as "TimeflowPointSnapshot" and an appropriate snapshot name is provided. Instead of "TimeflowPointSnapshot", you can also choose from "TimeflowPointLocation" or "TimeflowPointTimestamp" or "TimeflowPointBookmark" etc. and pass the relevant parameters.

You can list your Snapshots by following the instructions on API Cookbook: List Snapshots

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.