Blogs

Using the Delphix CLI to provision an Oracle VDB

By Tim Gorman posted 10-17-2015 05:55:50 PM

  
The Delphix command-line interface (CLI) is accessed using SSH.  It provides an application programmatic interface (API) that is primarily intended for automation, but also represents an alternate method of controlling the Delphix Engine.  There are many kinds of functionality accessible from the CLI which are not exposed on the Delphix graphical user interface (GUI), so in many ways, the CLI is the only way to do certain lesser-used functions.  There is more general information about the CLI in the documentation online here.

But once you have connected into your Delphix Engine using SSH, it is a good idea to bear in mind that there are two important commands to help you learn how to navigate the object model:  the TAB key and the “ls” command...

  • The TAB key is a context-sensitive hot key that displays what commands, command-qualifiers, or (in some cases) data values are available at any time.  In some contexts, the TAB key can also serve as a command completion function, similar to that found in some UNIX/Linux shells like “bash”
  • The “ls” command will always display the current data objects available in the current context
  • If you’re not examining a particular object at the moment, then “ls” will display the objects available to examine or act upon
  • If you are examining a particular object, then “ls” will display the current attributes and values within that object
  • “ls” will also display the commands available in the current context, similar to what the TAB key does
So, when you’re working in the CLI and you’re unsure what to do next (or what can be done), then use either the TAB key or the “ls” command to get an idea.

So, let’s use the Delphix CLI to provision a new Oracle virtual database (VDB).

Getting started now...

If you’ve just logged into the Delphix CLI, you’re likely to see a command-line prompt similar to the following, displaying the name of your Delphix Engine…

LandsharkEngine>

If you press the TAB key, you’ll see a listing of commands (or objects) on which you can work in multi-column format.

If you execute the “ls” command, then you’ll see the same list in one-column format…

LandsharkEngine> ls

Children

about

action

alert

analytics

authorization

capacity

connectivity

database

environment

fault

group

host

jetstream

job

namespace

network

permission

policy

replication

repository

role

service

session

snapshot

source

sourceconfig

system

timeflow

toolkit

user

 

Operations

version 

Since what we want to do is provision a virtual database, please enter the following command…

LandsharkEngine> database

 

Now that we in the database object, let’s run the “ls” command to see what’s what…

LandsharkEngine database> ls

Objects

NAME      PROVISIONCONTAINER  DESCRIPTION

xyzprd01  -                  

defprd01  -                  

vabctst1  abcprd01            -

vxyzdev1  xyzprd01            -

abcprd01  -                  

vdefdev1  defprd01            -

 

Children

template

 

Operations

createEmpty

createRestorationDataset

export

fileMapping

link

oracleSupportedCharacterSets

provision

validateXpp

xpp

In this context, within the database object, the “ls” command lists existing databases, lists any child objects, and then lists the operations which we can perform.

Selecting from the list of operations available to us in this context, let’s execute the provision operation…

LandsharkEngine database> provision

LandsharkEngine database provision *> ls

Properties

    type: OracleProvisionParameters

    container:

        type: OracleDatabaseContainer

        name: (required)

        description: (unset)

        diagnoseNoLoggingFaults: true

        group: (required)

        performanceMode: DISABLED

        preProvisioningEnabled: false

        sourcingPolicy: (unset)

    credential: (unset)

    openResetlogs: true

    physicalStandby: false

    source:

        type: OracleLiveSource

        name: (unset)

        archivelogMode: true

        config: (unset)

        configParams: (unset)

        configTemplate: (unset)

        dataAgeWarningThreshold: 900sec

        fileMappingRules: (unset)

        manualProvisioning: false

        mountBase: (required)

        nodeListenerList: (unset)

        operations: (unset)

        redoLogGroups: 3

        redoLogSizeInMB: 0

    sourceConfig:

        type: OraclePDBConfig

        cdbConfig: (required)

        databaseName: (required)

        environmentUser: (unset)

        linkingEnabled: true

        repository: (unset)

        services: (unset)

    timeflowPointParameters:

        type: TimeflowPointSemantic

        container: (required)

        location: LATEST_POINT

    username: (unset)

 

Operations

defaults

Please notice the “*” character in the command-line prompt?  This indicates that we’re now making a modification operation to the Delphix Engine.  From here on out, the only way to navigate out of this object’s context is to either commit the current modifications, or discard (i.e. rollback or cancel) the current modifications.

We can see that the “ls” command lists a lot of object attributes that need data values.  Please note the only operation available to us in this context:  defaults.  This operation will start to fill all of these attributes with default values, so let’s start with that…

LandsharkEngine database provision *> defaults

LandsharkEngine database provision defaults *> ls

Properties

    type: TimeflowPointSemantic

    container: (required)

location: LATEST_POINT

At this point, enter the name of the dSource or VDB from which the new virtual database will be provisioned, then commit the defaults operation, which still leaves us in the context of the database object…

LandsharkEngine database provision defaults *> set container=vabctst1

LandsharkEngine database provision defaults *> commit

LandsharkEngine database provision *> ls

Properties

    type: OracleProvisionParameters

    container:

        type: OracleDatabaseContainer

        name: abcprd01_UB2 (*)

        description: (unset)

        diagnoseNoLoggingFaults: true

        group: A - Sources (*)

        performanceMode: DISABLED

        preProvisioningEnabled: false

        sourcingPolicy:

            type: OracleSourcingPolicy (*)

            loadFromBackup: false (*)

            logsyncEnabled: false (*)

            logsyncInterval: 5sec (*)

            logsyncMode: UNDEFINED (*)

    credential: (unset)

    openResetlogs: true

    physicalStandby: false

    source:

        type: OracleVirtualSource (*)

        name: (unset)

        archivelogMode: true

        config: (unset)

        configParams:

            compatible: '10.2.0.5.0' (*)

            db_file_multiblock_read_count: 16 (*)

            db_flashback_retention_target: 4320 (*)

            job_queue_processes: 10 (*)

            log_archive_format: '%t_%s_%r.dbf' (*)

            open_cursors: 300 (*)

            pga_aggregate_target: 196083712 (*)

            processes: 150 (*)

            remote_login_passwordfile: 'EXCLUSIVE' (*)

            sga_target: 591396864 (*)

            undo_management: 'AUTO' (*)

        configTemplate: (unset)

        fileMappingRules: (unset)

        manualProvisioning: false

        mountBase: /mnt/provision (*)

        nodeListenerList: (empty) (*)

        operations:

            type: VirtualSourceOperations (*)

            configureClone: (empty) (*)

            postRefresh: (empty) (*)

            postRollback: (empty) (*)

            postSnapshot: (empty) (*)

            preRefresh: (empty) (*)

            preSnapshot: (empty) (*)

        redoLogGroups: 3

        redoLogSizeInMB: 0

    sourceConfig:

        type: OracleSIConfig (*)

        databaseName: abcp_UB2 (*)

        environmentUser: (unset)

        instance:

            type: OracleInstance (*)

            instanceName: abcprUB2 (*)

            instanceNumber: 1 (*)

        linkingEnabled: false (*)

        nonSysCredentials: (unset)

        nonSysUser: (unset)

        repository: tjg-lnxtgt01/'/u01/app/ora10205/product/10.2.0/db_1' (*)

        services: (empty) (*)

        uniqueName: abcprd01_UB2 (*)

    timeflowPointParameters:

        type: TimeflowPointSemantic

        container: abcprd01 (*)

        location: LATEST_POINT

    username: (unset)

 

Operations

defaults

In the new listing, you’ll notice that a lot of the attribute values have been filled in from the source object (i.e. the dSource object abcprd01).

Just as in the Delphix GUI provisioning wizard, some of the default values should be changed, such as the name of the VDB, the Oracle instance SID, the Oracle database unique name, and the name of the Delphix database group or “folder” into which the new virtual database should be created... 

LandsharkEngine database provision *> set container.name=vabctst2

LandsharkEngine database provision *> set container.group=”A - Targets”

LandsharkEngine database provision *> set source.name=vabctst2

LandsharkEngine database provision *> set sourceConfig.databaseName=vabctst2

LandsharkEngine database provision *> set sourceConfig.instance.instanceName=vabctst2

Just as in the Delphix GUI provisioning wizard, we may want to change the Oracle initialization parameters to that of a VDB Configuration Template, so let’s do that right now…

LandsharkEngine database provision *> set source.configTemplate=”VDB T01”

So now we’ve chosen to assign the VDB configuration template named “VDB T01” to the new virtual database.  We had to enclose the name within double-quotes because the name of the template contains a space character.

At this point, we could make additional changes, such as add “hooks”, just as you might choose to do using the provisioning wizard in the Delphix GUI console, but for simplicity we can just finish…

LandsharkEngine database provision *> commit

    vabctst2

    Dispatched job JOB-118835

    DB_PROVISION job started for "A - Targets/vabctst2".

    Starting provision of the virtual database "vabctst2".

    Creating new TimeFlow.

    Generating recovery scripts.

    Exporting storage.

    Mounting filesystems for the virtual database instance "1".

    Mounting read-only archive log filesystem for the virtual database instance "1".

    Recovering Oracle database.

    Opening the virtual database "vabctst2".

    Opening Oracle database.

    Oracle recovery was successful.

    Unmounting read-only archive log filesystem for the virtual database instance "1".

    The virtual database "vabctst2" was successfully provisioned.

    DB_PROVISION job for "A - Targets/vabctst2" completed successfully.

If you were to look at the Delphix GUI console while this was happening, you would see the provisioning job for the virtual database being created if you have toggled open the Actions bar on the right side of the screen.  You would also see the new virtual database appear in the left-hand object navigation bar in the Delphix GUI console, with a progress bar showing the status of completion of the operation.

Enjoy using the CLI, and especially don’t forget:  the TAB key and the “ls” command are your helpers and your friends.  Use them often, and everything will become less mysterious.


#Reporting
#DemoEnvironment
#Tip
0 comments
6 views