Tip of the Day: Using the API to Refresh VDBs

  • 1
  • Announcement
  • Updated 4 years ago
  • (Edited)
curl -v -X POST -k --data @- http://delphix-server/resources/json/delphix/database/ORACLE_DB_CONTAINER-13/refresh  \
-b ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
"type": "OracleRefreshParameters",
"timeflowPointParameters": {
"type": "TimeflowPointSemantic",
"timeflow": "ORACLE_TIMEFLOW-13",
"location": "LATEST_SNAPSHOT"
}
}
EOF
*For more information about the content of refresh parameters, see the /api/#RefreshParameters reference on your local Delphix Engine. Depending on the type of the database, the following parameter types are available:
  • OracleRefreshParameters
  • MSSqlRefreshParameters
Photo of Delphix FAQs

Delphix FAQs, Official Rep

  • 4,000 Points 4k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
I am working on a script to be able to refresh VDB's and I do not see "timeflow" as a value that can be set. I am looking at it when using the CLI with setopt trace=on. Any thoughts on how to get the refresh to use the latest timeflow everytime?
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Sorry I mean setopt trace=true. 
Photo of Uday Kumar

Uday Kumar, Employee

  • 180 Points 100 badge 2x thumb

Hello Colin, Pls check on below script.

#!/bin/sh

# Example for Refreshing a VDB

# Delphix Web Service API create a session

curl -s -X POST -k --data @- http://delphixengine/resources/json/delphix/session \

    -c ~/cookies.txt -H "Content-Type: application/json" <<EOF

{

    "type": "APISession",

    "version": {

        "type": "APIVersion",

        "major": 1,

        "minor": 2,

        "micro": 0

    }

}

EOF


# Delphix Web Service API Login Credentials to DE

curl -s -X POST -k --data @- http://delphixengine/resources/json/delphix/login \

    -b ~/cookies.txt -H "Content-Type: application/json" <<EOF

{

    "type": "LoginRequest",

    "username": "delphix_admin",

    "password": "xxxxxx"

}

EOF


# Delphix Web Service API Refresh a VDB

# The URL Container should be of VDB and the parameter passed in Container should be that of dSource

curl -s -X POST -k --data @- http://delphixengine/resources/json/delphix/database/ORACLE_DB_CONTAINER-253/refresh \

  -b ~/cookies.txt -H "Content-Type: application/json" <<EOF

{

 "type": "OracleRefreshParameters",

 "timeflowPointParameters": {

 "type": "TimeflowPointSemantic",

 "container": "ORACLE_DB_CONTAINER-180", 

 "location": "LATEST_SNAPSHOT"

 }

}

EOF

Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Thanks for the reply. What you show is what I attempted before I found this post and with no luck. I have attempted again but to no avail. Here is what I am seeing when I attempt to do the refresh from the CLI. Here is my object:

Properties    type: OracleRefreshParameters
    credential: (unset)
    timeflowPointParameters:
        type: TimeflowPointSemantic
        container: colin (*)
        location: LATEST_POINT
    username: (unset)




Here is the error when I commit:

 Error: A snapshot cannot be found for the selected TimeFlow point Kronos/colin location: 9223372036854775807. Action: Select a different TimeFlow point.


So the only thing that I can think is that I am getting the container incorrect, but when I set the attribute using:

set timeflowPointParameters.container="ORACLE_DB_CONTAINER-278"

then I look at the refresh object, it shows the correct database name:

container: colin (*)


Any other thoughts on what might be causing the issue?

Thanks again.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Also, just FYI, I am also doing MSSQL Server refreshes using the same process, with a different Properties type of course, and that is working just fine.  That is another reason why I think I am getting the container information correct as I am grabbing it in the same way. The code is not changing between the two db types except for the the type really. 

Also I am doing all this in PowerShell, that should not matter but wanted to give you all the information.

Thanks
Photo of Ranzo Taylor

Ranzo Taylor, Employee

  • 1,572 Points 1k badge 2x thumb
Colin, does it work if you change LATEST_POINT to LATEST_SNAPSHOT?
Photo of Uday Kumar

Uday Kumar, Employee

  • 180 Points 100 badge 2x thumb
Thanks Colin. Did you try copying my script and replacing values where necessary....I did execute this script and was able to refresh the VDB successfully.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
I have tried changing to LATEST_SNAPSHOT and I still get the error. i did not copy your script as I am just attempting to get it done in the CLI so I can get a look at the JSON object that I need to pass in. Any chance you could help me out with a webex?
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
I have this working now. Appears that nothing was wrong with the CLI object though. I am investigating now as I am not sure what the issue was but if I find out I will post it here.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Update -- So I am not sure what the issue was. but here is what we did to correct the issue after we found that we were not able to refresh from the CLI or the API.

1. Refreshed the environment.
2. Created a Listener
3. Manually refreshed the VDB to see if it would work from the Delphix GUI - It did.

Then we refreshed via the CLI with no issue.
Then we shutdown the listener to see if that had any affect. No affect as we were able to refresh via the CLI again. So we are not sure if it was the environment refresh or the refresh of the VDB via the GUI that resolved the issue. We are attempting to re-create the issue. If we can I will update again.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Update -- So I am not sure what the issue was. but here is what we did to correct the issue after we found that we were not able to refresh from the CLI or the API.

1. Refreshed the environment.
2. Created a Listener
3. Manually refreshed the VDB to see if it would work from the Delphix GUI - It did.

Then we refreshed via the CLI with no issue.
Then we shutdown the listener to see if that had any affect. No affect as we were able to refresh via the CLI again. So we are not sure if it was the environment refresh or the refresh of the VDB via the GUI that resolved the issue. We are attempting to re-create the issue. If we can I will update again.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Update -- So I am not sure what the issue was. but here is what we did to correct the issue after we found that we were not able to refresh from the CLI or the API.

1. Refreshed the environment.
2. Created a Listener
3. Manually refreshed the VDB to see if it would work from the Delphix GUI - It did.

Then we refreshed via the CLI with no issue.
Then we shutdown the listener to see if that had any affect. No affect as we were able to refresh via the CLI again. So we are not sure if it was the environment refresh or the refresh of the VDB via the GUI that resolved the issue. We are attempting to re-create the issue. If we can I will update again.
Photo of Colin Smith

Colin Smith

  • 150 Points 100 badge 2x thumb
Update 2 
We were unable to recreate the issue. We started over and provisioned a new VDB in the same manner. No listener and did not refresh the environment but we were able to refresh the VDB from the CLI with no issue. Very strange.....
Photo of Uday Kumar

Uday Kumar, Employee

  • 180 Points 100 badge 2x thumb
Nice to hear that you got it working. Pls let us know your investigation results. Thanks
Photo of Ranzo Taylor

Ranzo Taylor, Employee

  • 1,572 Points 1k badge 2x thumb
Colin, it certainly sounds like you've done a thorough job.  I'm opening a support ticket on your behalf to try to understand why it didn't work in the first place.  Please upload support logs so we can take a look and get to the bottom of this.