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
- 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.
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
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 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
Operations performed after initial provision or after a refresh.
This hook will run after the virtual dataset has been started.
Operations performed before a refresh.
These operations can cache data from the virtual dataset to be restored after the refresh completes.
Operations performed after a refresh.
These operations can restore cached data after the refresh completes.
Operations performed before a rewind.
These operations can cache data from the virtual dataset to be restored after the rewind completes.
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.
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.
Operations performed after a snapshot.
These operations can undo any changes made by the Pre-Snapshot hook.
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.
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.
Operations performed before shutdown of a VDB or vFile.
These operations can quiesce data or processes prior to virtual dataset shutdown.
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