Introduction
Delphix provides two similar, but different, mechanisms for customizing data management operations on SQL Server:
- Pre-Script and Post-Script
- available only for backwards compatibility
- Hooks
- introduced for SQL Server in Delphix Engine v4.3
- this is the more fully-functional mechanism
Both of these mechanisms are designed to allow custom-built scripts to be executed on a target host before or after Delphix operations such as dSource synchronizing, VDB provisioning, VDB refreshing, rewinding a VDB, or starting or stopping a VDB. The purpose of such programmatic call-outs is to permit each Delphix object to be customized as needed.
For example, it is common to reset the passwords for database- or application-accounts when cloning from production, so that non-production users can access those accounts without jeopardizing security or privacy in production. Likewise, there are other data which might need to be changed when cloning production to non-production, such as the IP hostnames or addresses of related systems, the pathnames of objects located in file-systems, and other application context settings which will need to be pointed to their appropriate equivalent in their non-production environment. Sometimes, it might be automatically logging completed actions to an enterprise audit trail, or automatically starting another action.
For all of these customization purposes and more, hooks can be crafted to satisfy the purpose
NOTE: in this section, we'll describe how to use both the hook and pre-/post-script mechanisms, but it is strongly recommended the Hooks functionality is used over the pre-/post-script functionality.
Execution Environment
Pre-/Post-Scripts execute as a Windows Powershell session only, while Hooks can execute either as a Windows Powershell session (default), or as a Masking job session.
For pre-/post-scripts and hooks defined as Windows Powershell sessions, the execution environment is...
- For dSources, the Powershell session executes on the staging (validated-sync) target host using the environment user Windows domain account assigned to the dSource.
- For VDBs or vFiles, the Powershell session executes on the VDB target host using the environment user Windows domain account assigned to the VDB or vFile.
Hooks which are defined as masking job sessions execute on the Delphix Masking Engine, and adhere to the environment, connector, and rule-set configurations of that previously-defined masking job. For more information, please go to the Delphix Masking Engine Users Guide.
Types of Operations
Hooks for dSources
Hook | Description |
---|---|
Pre-Sync | Pre-sync hook operations are executed before a Snapsync of a dSource. These operations can quiesce data to be captured during the Snapsync, or stop application processes that may interfere with the Snapsync operation. |
Post-Sync | Post-Sync hook operations are executed after a Snapsync operation of a dSource. These operations can undo any changes made by the pre-sync hooks. They will run regardless of the success of pre-sync hook operations or the Snapsync itself. |
Hooks for VDBs and vFiles
Hook | Description |
---|---|
Configure Clone | Operations performed after initial provision or after a refresh. This hook will run after the virtual dataset has been started. |
Pre-Refresh | Operations performed before a refresh. These operations can cache data from the virtual dataset to be restored after the refresh completes. |
Post-Refresh | Operations performed after a refresh. These operations can restore cached data after the refresh completes. |
Pre-Rewind | Operations performed before a rewind. These operations can cache data from the virtual dataset to be restored after the rewind completes. |
Post-Rewind | Operations performed after a rewind. This hook will not run if the rewind or Pre-Rewind hook operations fail. These operations can restore cached data after the rewind completes. |
Pre-Snapshot | Operations performed before a snapshot. These operations can quiesce data to be captured during the snapshot, or stop processes that may interfere with the snapshot. |
Post-Snapshot | Operations performed after a snapshot. These operations can undo any changes made by the Pre-Snapshot hook. |
Pre-Start | Operations performed before startup of a VDB or vFile. These operations can be used to initialize configuration files, or stop processes that might interfere with the virtual dataset. |
Post-Start | Operations performed after startup of a VDB of vFile. These operations can be used to clean up any temporary files, or restart processes that may have been stopped by a Pre-Start hook, or log notifications. |
Pre-Stop | Operations performed before shutdown of a VDB or vFile. These operations can quiesce data or processes prior to virtual dataset shutdown. |
Post-Stop | Operations performed after shutdown of a VDB or vFile. These operations can be used to log notifications, clean up any temporary files, or stop/restart related processes. |
Sequence of Operations
The most basic thing to understand about hooks is when they execute. There are many different hooks in Delphix, so understanding the sequence of operations is important to understanding the power of this capability, and the granularity to which operations can be separated.
Here is a list of Delphix operations and the order in which hooks and pre-/post-scripts are executed...
Linking or Syncing a dSource
Sequence | Delphix operation | Hook | Pre-/Post-script |
---|---|---|---|
t0 | Pre-Script | ||
t1 | Pre-Sync | ||
t1 | dSource Sync | ||
t2 | Post-Sync | ||
t3 | Post-Script |
VDB Provision
Sequence | Delphix operation | Hook | Pre-/Post-script |
---|---|---|---|
t0 | Pre-Script | ||
t1 | Pre-Start | ||
t2 | VDB start | ||
t3 | Post-Start | ||
t4 | Post-Script | ||
t5 | Configure Clone | ||
t6 | Pre-Snapshot | ||
t7 | VDB snapshot | ||
t8 | Post-Snapshot |
VDB Refresh
Sequence | Delphix operation | Hook | Pre-/Post-script |
---|---|---|---|
t0 | Pre-Refresh | ||
t1 | Pre-Stop | ||
t2 | VDB stop | ||
t3 | Post-Stop | ||
t4 | Pre-Script | ||
t5 | Pre-Start | ||
t6 | VDB start | ||
t7 | Post-Start | ||
t8 | Post-Script | ||
t9 | Configure Clone | ||
t10 | Post-Refresh | ||
t11 | Pre-Snapshot | ||
t12 | VDB snapshot | ||
t13 | Post-Snapshot |
VDB Snapshot
Sequence | Delphix operation | Hook | Pre-/Post-Script |
---|---|---|---|
t0 | Pre-Snapshot | ||
t1 | VDB snapshot | ||
t2 | Post-Snapshot |
VDB Rewind
Sequence | Delphix operation | Hook | Pre-/Post-Script |
---|---|---|---|
t0 | Pre-Rewind | ||
t1 | Pre-Stop | ||
t2 | VDB stop | ||
t3 | Post-Stop | ||
t4 | Pre-Script | ||
t5 | Pre-Start | ||
t6 | VDB start | ||
t7 | Post-Start | ||
t8 | Post-Script | ||
t9 | Post-Rewind | ||
t10 | Pre-Snapshot | ||
t11 | VDB snapshot | ||
t12 | Post-Snapshot |