Skip to main content
Skip table of contents

Oracle hook operations

Oracle RAC

When linking from, or provisioning to Oracle RAC environments, hook operations will not run once on each node in the cluster. Instead, the Delphix Engine picks a node in the cluster at random and guarantees all operations within any single hook will execute serially on this node.

Note that the Delphix Engine does not guarantee the same node is chosen for the execution of every hook but does guarantee that Pre-/Post- hook pairs (such as Pre-Sync and Post-Sync) will execute on the same node.

Shell operations

RunCommand operation

The RunCommand operation runs a shell command on a Unix environment using whatever binary is available at /bin/sh. The environment user runs this shell command from their home directory. The Delphix Engine captures and logs all output from this command. If the script fails, the output is displayed in the Delphix Management application and command-line interface (CLI) to aid in debugging.

If successful, the shell command must exit with an exit code of 0. All other exit codes will be treated as an operation failure.

Examples of RunCommand operations

You can input the full command contents into the RunCommand operation.

CODE
remove_dir="$DIRECTORY_TO_REMOVE_ENVIRONMENT_VARIABLE"
 
if test -d "$remove_dir"; then
    rm -rf "$remove_dir" || exit 1
fi
 
exit 0

If a script already exists on the remote environment and is executable by the environment user, the RunCommand operation can execute this script directly.

CODE
/opt/app/oracle/product/10.2.0.5/db_1/dbs/myscript.sh "$ARG_ENVIRONMENT_VARIABLE" "second argument in double quotes" 'third argument in single quotes'

RunBash operation

The RunBash operation runs a Bash command on a Unix environment using a bash binary provided by the Delphix Engine. The environment user runs this Bash command from their home directory. The Delphix Engine captures and logs all output from this command. If the script fails, the output is displayed in the Delphix Management application and command-line interface (CLI) to aid in debugging.

If successful, the Bash command must exit with an exit code of 0. All other exit codes will be treated as an operation failure.

Example of RunBash operations

You can input the full command contents into the RunBash operation.

CODE
remove_dir="$DIRECTORY_TO_REMOVE_ENVIRONMENT_VARIABLE"

# Bashisms are safe here!
if [[ -d "$remove_dir" ]]; then
    rm -rf "$remove_dir" || exit 1
fi
 
exit 0

Shell operation tips

Using nohup

You can use the nohup command and process backgrounding from resource in order to "detach" a process from the Delphix Engine. However, if you use nohup and process backgrounding, you MUST redirect stdout and stderr.

Unless you explicitly tell the shell to redirect stdout and stderr in your command or script, the Delphix Engine will keep its connection to the remote environment open while the process is writing to either stdout or stderr . Redirection ensures that the Delphix Engine will see no more output and thus not block waiting for the process to finish.

For example, imagine having your RunCommand operation background a long-running Python process. Below are the bad and good ways to do this.

Bad Examples

  • nohup python file.py & # no redirection

  • nohup python file.py 2>&1 & # stdout is not redirected

  • nohup python file.py 1>/dev/null & # stderr is not redirected

  • nohup python file.py 2>/dev/null & # stdout is not redirected

Good Examples

  • nohup python file.py 1>/dev/null 2>&1 & # both stdout and stderr redirected, Delphix Engine will not block

Other operations

RunExpect operation

The RunExpect operation executes an Expect script on a Unix environment. The Expect utility provides a scripting language that makes it easy to automate interactions with programs which normally can only be used interactively, such as ssh. The Delphix Engine includes a platform-independent implementation of a subset of the full Expect functionality.

The script is run on the remote environment as the environment user from their home directory. The Delphix Engine captures and logs all output of the script. If the operation fails, the output is displayed in the Delphix Management application and CLI to aid in debugging.

If successful, the script must exit with an exit code of 0. All other exit codes will be treated as an operation failure.

Example of a RunExpect operation

Start an ssh session while interactively providing the user's password.

CODE
spawn ssh user@delphix.com
expect {
    -re {Password: } {
        send "${env(PASSWORD_ENVIRONMENT_VARIABLE)}\n"
    }
    timeout {
        puts "Timed out waiting for password prompt."
        exit 1
    }
}
exit 0

Oracle environment variables

to access the dSource or VDB.

dSource environment variables

Environment variable

Description

ORACLE_SID

The SID of the dSource

ORACLE_BASE

The home directory of the Oracle software hosting the dSource

ORACLE_HOME

The Oracle Home for the dSource

CRS_HOME (only set for RAC dSources)

The home directory for cluster services hosting the dSource

ORAENV_ASK

Always set to NO

DELPHIX_DATABASE_NAME

The database name reported by Oracle

DELPHIX_DATABASE_UNIQUE_NAME

The database unique name reported by Oracle

DELPHIX_PDB_NAME (only set for PDBs)

The PDB name reported by Oracle

VDB environment variables

Environment variable

Description

ORACLE_SID

The SID for the VDB

ORACLE_BASE

The home directory for the Oracle software hosting the VDB

ORACLE_HOME

The Oracle Home for the VDB

CRS_HOME (only set for RAC VDBs)

The home directory for cluster services hosting the RAC VDB

ORAENV_ASK

Always set to NO

DELPHIX_DATABASE_NAME

The database name reported by Oracle

DELPHIX_DATABASE_UNIQUE_NAME

The database unique name reported by Oracle

DELPHIX_PDB_NAME (only set for PDBs)

The PDB name reported by Oracle

DELPHIX_MOUNT_PATH

The root of the NFS mount hosting the VDB data

BASH
MASKING_CONNECTOR_HOST (only set for masked provisioning)

The host that DMSuite will use for the connector

BASH
MASKING_CONNECTOR_PORT (only set for masked provisioning)

The port that DMSuite will use for the connector

PATH and LD_LIBRARY_PATH configuration

PATH is configured by appending the bin directory in the Oracle home for the dSource or VDB.

LD_LIBRARY_PATH is configured by appending the lib directory in the Oracle home for the dSource or VDB.

JavaScript errors detected

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

If this problem persists, please contact our support.