dSource Hooks
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. |
VDB and vFile Hooks
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. |
Hooks
Operation Failure
If a hook operation fails, it will fail the entire hook: no further operations within the failed hook will be run.
Setting Hook Operations
You can construct hook operation lists through the Delphix Management application or the command line interface (CLI). You can either define the operation lists as part of the provisioning process or edit them on virtual datasets that already exist.
Setting Hook Operations through the Delphix Management Application
Hook operations can be provisioned in the Hooks tab of the Add dSource or Add VDB wizards.
- Select the type of operation and enter a name, operation type, and script.
- To remove an operation from the list, click the Trash icon on the operation.
- When you have set all hook operations, click Next to continue with the provisioning process.
To edit hook operations on a virtual dataset:
- In the Datasets panel, click the virtual dataset.
- Click the Configuration tab.
- Within the Configuration tab, click the Hooks tab.
- Select the hook to edit.
- The current operations at this hook will be displayed. To edit this list of operations, click the Pencil icon in the top right-hand corner of the tab.
- Click the Plus icon to add a new operation.
- Select the type of operation or click to load a hook operation template.
- Click the text area and edit the contents of the operation.
- To remove an operation from the list, click the Trash icon on the operation.
- When you have set all hook operations, click the checkmark to save the changes.
Setting Hook Operations through the CLI
LinkingParameters > Source > Operations
object.To specify hook operations during provisioning, edit the relevant hook's array of operations defined on the ProvisionParameters > Source > Operations
object.
To edit hook operations on a dSource that already exists, edit the relevant hook's array of operations defined on the Source > Operations
object.
To edit hook operations on a virtual dataset that already exists, edit the relevant hook's array of operations defined on the Source > Operations
object.
For more information about these CLI objects, see the following documentation in the Help menu of the Delphix Management application:
-
LinkedSourceOperations
VirtualSourceOperations
RunCommandOnSourceOperation
RunExpectOnSourceOperation
API
Example of Editing Hook Operations through the CLI
- Navigate to the relevant source's
VirtualSourceOperations
object. - Select a hook to edit.
delphix> source delphix source> select "pomme" delphix source "pomme"> update delphix source "pomme" update *> edit operations delphix source "pomme" update operations *> edit postRefresh
- Add an operation at index 0.
delphix source "pomme" update operations postRefresh *> add delphix source "pomme" update operations postRefresh 0 *> set type=RunCommandOnSourceOperation delphix source "pomme" update operations postRefresh 0 *> set command="echo Refresh completed." delphix source "pomme" update operations postRefresh 0 *> ls Properties type: RunCommandOnSourceOperation (*) command: echo Refresh completed. (*) delphix source "pomme" update operations postRefresh 0 *> commit
- Add another operation at index 1 and then delete it.
delphix source "pomme" update operations postRefresh *> add delphix source "pomme" update operations postRefresh 1 *> set type=RunCommandOnSourceOperation delphix source "pomme" update operations postRefresh 1 *> set command="echo Refresh completed." delphix source "pomme" update operations postRefresh 1 *> back delphix source "pomme" update operations postRefresh *> unset 1 delphix source "pomme" update operations postRefresh *> commit
Hook Operation Templates
You can use templates to store commonly used operations, which allows you to avoid repeated work when an operation is applicable to more than a single virtual dataset. You manage templates through the Delphix Management application.
Hook Operations Templates Not Available via CLI
Hook operation templates cannot be fully utilized from the CLI. Manage and use hook operations through the Delphix Management application.
Creating a Hook Operation Template
- Login to the Delphix Management application using Delphix Admin credentials.
- Click Manage.
- Select Operation Templates.
- Click the Plus icon to add a new operation template.
- Enter a Name for the template.
- Select an operation Type.
- Enter a Description detailing what the operation does or how to use it.
- Enter operation Contents to implement the operation partially or fully.
- Click Create.
Importing a Hook Operation Template
- In the Datasets panel, select a dataset.
- Click the Configuration tab.
- Within the Configuration tab, click the Hooks tab.
- Select the hook to edit.
- Click the Plus icon to add a new operation.
- Click Import.
- Select the template to import.
- Click Import.
- When you have set all hook operations, click Check to save the changes.
Exporting a Hook Operation Template
- In the Datasets panel, select a dataset.
- Click the Configuration tab.
- Within the Configuration tab, click the Hooks tab.
- Select the hook to edit.
- Click the Plus icon to add a new operation.
- Select the type of operation.
- Click the text area and edit the contents of the operation.
- Click Export.
- Enter a Name for the template.
- Enter a Description detailing what the operation does or how to use it.
- Click Export.
Considerations for Delphix Hook Operations on Oracle RAC VDBs
When performing data management operations like snapsync, refresh and so on with Delphix data sources such as VDB and dSources, Delphix offers "hooks" as an ability to perform tasks prior to and after these data management operations. For an introduction and more details about hooks refer to, Oracle Hooks for data sources.
Mostly the above article discusses shell operations within the hooks. But sometimes you might need to run a SQL script within the hook to capture or alter the database state before or after a Delphix operation on that source. In a sample scenario, we might be connecting to the database and running some SQL script which does the operations and perhaps generates some files for later use.
In such a case, there is no need to set the oracle environment in the script and in fact setting the ORACLE_SID value in the script can be a problem for RAC instances. From the article linked above, these are the details of hook operations as they relate to RAC VDBs:
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 operation within any single hook will execute serially on this node.
If the data source (or VDB) is a single instance Oracle, explicitly setting variable in script should not be a problem, since local listener will be aware of the SID in the connect string. But for a RAC, since we will not be sure which node the hook will run against beforehand, do not statically allocate the variables, the engine will determine the connect string based on the databases section of the environments page of the admin app GUI.
Troubleshooting
Hook operations do not work for Delphx RAC installations.
Resolution
Remove any oracle environment setting parameters in the script and consider that the hook will run arbitrarily against any of the RAC nodes. Validate that the connect string works for the Environment>Databases section for the dSource in question.
Additional Information
For more information about validating and setting connection strings refer to, Adding JDBC Connection String.