Delphix Products

  • 1.  How can I check for existence of a vdb

    Posted 09-07-2017 12:58:00 PM
    Hi - I am trying to automate provisioning of VDBs, while doing it I also want to check for existence of a VDB and if it exists I want to drop it before going ahead to provision it. I found dx_get_db_env as part of the delphix toolkit but that returns all the VDBs. How can I check for one VDB so that I can either get a 0 or a 1 return and based on that I can provision / remove and then provision the VDB.

    Thanks.


  • 2.  RE: How can I check for existence of a vdb

    Posted 09-07-2017 02:56:00 PM
    One advantage of dxtoolkit is that you can pipe the output to other UNIX commands.  Try the following:

    dx_get_db_env | grep VDB_NAME
    echo $?

    The grep command returns a "0" if it find a match for a regular expression (in this case, the VDB_NAME you are looking for.  You query the return code of the last command in UNIX with the special string "$?".

    If $? equals 0, you have the VDB_NAME already.  If it's 1, you don't.