Object IDs and names
Because DCT manages a large number of objects across multiple Delphix engines, each object is assigned an ID that is globally unique within DCT. The object ID specified in dct-toolkit, such as vdbId, must use this DCT object ID. In some cases, the object ID is visible in the DCT GUI. In most cases, however, it is easier to obtain it from the output returned by list commands or by the get_xxx or search_xxx commands.
$ dct-toolkit get_vdbs
id | database_type | name | is_replica | is_locked
-----------------------------------------------------------------------------------------
1-APPDATA_CONTAINER-12 | Postgres-VSDK | pgsql_masked | false | false
1-APPDATA_CONTAINER-26 | mysql-plugin | vmysqlm1 | false | false
1-ORACLE_DB_CONTAINER-6 | Oracle | mdb01 | false | false
2-APPDATA_CONTAINER-5 | postgres-vsdk | pgsql_masked | true | false
2-APPDATA_CONTAINER-6 | postgres-vsdk | vpgsql1 | false | false
2-APPDATA_CONTAINER-7 | postgres-vsdk | VPGSQL2 | false | false
2-APPDATA_CONTAINER-8 | postgres-vsdk | vpgsql1s | false | false
2-APPDATA_CONTAINER-9 | postgres-vsdk | vpgsql2s | false | false
2-ORACLE_DB_CONTAINER-2 | Oracle | mdb01 | true | false
2-ORACLE_DB_CONTAINER-4 | Oracle | vpdb01 | false | false
---
response_metadata:
total: 10
Since Object IDs are often not known ahead of time (and not friendly to remember or work with), dct-toolkit will accept an object name wherever an object id is expected in any of the command parameters, as long as the object name is globally unique. For example, the following dct-toolkit commands are equivalent if AppFS_DEV is the name corresponding to the VDB with id MSSQL_DB_CONTAINER-10 and is globally unique.
dct-toolkit get_vdb_by_id vdb_id="2-MSSQL_DB_CONTAINER-10"
dct-toolkit get_vdb_by_id vdb_id="AppFS_DEV"
However, if the object name is not unique, in this example if 2 or more VDBs have the same name, using the VDB name would fail:
dct-toolkit get_vdb_by_id vdb_id="AppFS_DEV"
Multiple objects match the provided ID.
The solution would then be to search for the VDBs with that name and identify the ID of the VDB:
dct-toolkit search_vdbs name=AppFS_DEV -c id,database_type,name,engine_name,group_name
id | database_type | name | engine_name | group_name |
----------------------------------------------------------------------------------------------------
2-MSSQL_DB_CONTAINER-10 | MSSql | AppFS_DEV | dev-engine-1 | dev-group |
3-MSSQL_DB_CONTAINER-127 | MSSql | AppFS_DEV | dev-engine-2 | qa-group |
---
response_metadata:
total: 2
Here is another example where names are used instead of IDs for multiple parameters:
dct-toolkit provision_vdb_by_snapshot appdata source_data_id="AppFS_MASK" name="AppFS_DEV" environment_id="Postgres_Target" environment_user_id="delphix" --auto_select_repository target_group_id='DEV' mount_point="/mnt/provision/AppFS_DEV"
Note that object names in DCT are case sensitive, meaning that AppFS_DEV is not equivalent to appfs_dev.
Filter, sort, and format output
When you use dct-toolkit from a shell or script, output format, sorting, and filtering options make it easier to store values in variables and perform downstream processing.
-
CSV format output
Add
-csor--csvto output results in CSV format.$ dct-toolkit get_vdbs --csv id,database_type,name,is_replica,is_locked,size,storage_size,engine_id,status,... 1-APPDATA_CONTAINER-12,postgres-vsdk,pgsql_masked,false,false,73734144,2135040,1,RUNNING,... 1-APPDATA_CONTAINER-26,mysql-plugin,vmysqlm1,false,false,40156160,1305600,1,RUNNING,... 1-ORACLE_DB_CONTAINER-6,Oracle,mdb01,false,false,34612084736,21063223808,1,RUNNING,... ... -
JSON format output
Add
-jsor--jsonto output results in JSON format.$ dct-toolkit get_vdbs --json { "items" : [ { "id" : "1-APPDATA_CONTAINER-12", "database_type" : "postgres-vsdk", "name" : "pgsql_masked", "is_replica" : false, "is_locked" : false, "size" : 73734144, "storage_size" : 2135040, ... } ] } -
Sorting output
Use
sort=xxxto sort the output.Example 1, sort by name in ascending order:
$ dct-toolkit get_vdbs sort=nameExample 2, sort by
creation_datein descending order by adding - before the field name:$ dct-toolkit get_vdbs sort=-creation_date -
Filter output columns
Use
-cor--columnsto output only specific columns. This option applies to the default table format and CSV output.$ dct-toolkit get_vdbs --columns=id,name id | name -------------------------------------------- 1-APPDATA_CONTAINER-12 | pgsql_masked 1-APPDATA_CONTAINER-26 | vmysqlm1 ... $ dct-toolkit get_vdbs --columns=id,name --csv id,name 1-APPDATA_CONTAINER-12,pgsql_masked 1-APPDATA_CONTAINER-26,vmysqlm1 ... -
Filter output with JsonPath
Use
-jpto filter JSON output with JsonPath.Example 1: Extract id values in JSON format $ dct-toolkit get_vdbs -jp=$.items[*].id --json [ "1-APPDATA_CONTAINER-12", "1-APPDATA_CONTAINER-26", ... ] Example 2: Extract id and name values in JSON format $ dct-toolkit get_vdbs -jp="$.items[*]['id','name']" --json [ { "id" : "1-APPDATA_CONTAINER-12", "name" : "pgsql_masked" }, ... ] Example 3: Extract the id where name='mdb01' and is_replica=false $ dct-toolkit get_vdbs -jp="$.items[*][?( @.name == 'mdb01')][?( @.is_replica == false)].id" --json [ "1-ORACLE_DB_CONTAINER-6" ] Example 4: Extract the most recently created bookmark_id for a VDB $ dct-toolkit search_bookmarks_by_vdb vdb_id=2-ORACLE_DB_CONTAINER-4 \ sort=-creation_date -jp=$.items[0].id --json "a5de7eb7dcfe442dbcb667287c8c8d94"