What Are Hooks?

Hooks are programmatic call-outs embedded before and after dataset manipulation operations within the Delphix Engine. These programmatic call-outs provide the ability for the Delphix Engine to run custom-built PowerShell scripts directly on the Windows database server.

Hooks and Data Operations

Delphix dSources are manipulated by "Sync" operations, in which the Delphix Engine captures data changes from backups of the source database appends them to the dSource. The pre-sync and post-sync hooks are executed in PowerShell by the "environment user" Windows domain account (delphix_trgt) on the staging target. Since the dSource is a database in recovery mode within the SQL instance on the staging target, no database operations can be performed on the dSource itself, but file-operations on the staging target are possible.

Delphix VDBs are manipulated by Provision, Refresh, Rewind, Snapshot, Start, and Stop operations. The Configure Clone, Pre-Refresh, Post-Refresh, Pre-Rewind, Post-Rewind, Pre-Snapshot, Post-Snapshot, Pre-Start, Post-Start, Pre-Stop, and Post-Stop hooks are executed in PowerShell by the Windows "environment user" Windows domain account (delphix_trgt) on the VDB on the target.

Here are some example use-cases and solutions using hooks:

  • Your organization might require that a notification be sent to a distribution list five minutes before anyone refreshes or rewinds a VDB that is used for development or testing. You can write and test that logic in a PowerShell script and then embed it into the Pre-Refresh, Pre-Rewind, and Pre-Stop hooks on all VDBs. This PowerShell script can send email to a specified distribution list, and then pause for 300 seconds (5 minutes) before allowing the operation to continue.
  • Update data within a VDB when it is first provisioned and again after each refresh from the dSource. A very common example of this is data masking or anonymization, to prevent confidential data from being visible to the users and administrators of the VDB. Delphix has integrated data masking, but you can still initiate the appropriate job and poll until it completes using a PowerShell script.
  • During a refresh of a VDB from the dSource, save the non-production database and application passwords, then restore them after the refresh is complete.
  • Debug the sequence and timing of dataset manipulation operations within the Delphix Engine by logging hook executions to a file

There are many more potential use-cases for hooks, but hopefully, these examples will begin to show the way.

Related Topics