Skip to content
Ranzo J Taylor, III edited this page Oct 9, 2020 · 45 revisions

Overview

dxhooks is a set of scripts, which are delivered by Delphix professional services team. The script is written as a framework to extend VDBs through hooks.

It is written in shell and easily adaptable by DBAs.

Why the need for dxhooks?

The dxhooks project allows you to download typical hook code, customize your hook library once, and easily port it to every database server. You can keep your own repo of hook code and push it to all database servers with simple automation. It also handles a lot of the plumbing for you: setting up SQLPlus, logging, rotating logs, etc.

  • Frequent requests of hook scripts
  • Speed up the VDB deliverables to end-users
  • No more multiple versions of hook scripts
  • No Global Repo in Centralized Management for Multi-Engine Deployments
  • With Operation Templates, if you have to make a change you can't easily push it out to all the VDBs currently using that hook...takes many clicks.
  • Automation--no current way to pull from an Operation Template without using the GUI.
  • We can "ship" hooks for typical requests: expdb/impdb, /etc/hosts, listeners, password
  • Plumbing: Logs/Debugging, how to run SQL
  • Large organization already used to managing their scripts on the OS, they don't want to hit a GUI. Many already have a single admin server with NFS mounts to all the DB servers

Install Notes

The dxhooks scripts are provided as a tar file and can be decompressed using tar command. The script provides a template in setting setting up a pre and post script implementation for VDB operations. It can be run on Unix and Linux platform.

The current release only support Oracle. The future version will extend support to SAP ASE, MS SQL Server, and vFiles. More to come...

Install Procedure

  1. Download the dxhooks-<version>.tar from Github releases page.
  2. Copy the dxhooks-<version>.tar to target host
  3. Extract the dxhooks-<version>.tar file
$ tar xvf dxhooks-1.1.0.tar 
dxhooks/
dxhooks/dxh_dbclone.sh
dxhooks/dxh_oracle_hook.sh
dxhooks/dxh_impdp.sh
dxhooks/dxh_hook_profile.sh
dxhooks/DBTEMPLATE/
dxhooks/DBTEMPLATE/post-start/
dxhooks/DBTEMPLATE/post-start/scripts/
dxhooks/DBTEMPLATE/post-start/scripts/dxh_wrapper_script.sh
dxhooks/DBTEMPLATE/post-start/sql/
dxhooks/DBTEMPLATE/post-start/sql/dxh_reset_user_password.sql
dxhooks/DBTEMPLATE/post-start/sql/dxh_custom_create_user.sql
dxhooks/DBTEMPLATE/post-start/sql/dxh_wrapper_script.sql
dxhooks/DBTEMPLATE/post-start/parfile/
dxhooks/DBTEMPLATE/post-start/parfile/DBTEMPLATE.expdp.delphix.par
dxhooks/DBTEMPLATE/post-start/parfile/DBTEMPLATE.impdp.delphix.par
......
......
dxhooks/dxh_hook_functions.sh
dxhooks/dxh_expdp.sh
dxhooks/dxh_runsql.sh
  1. From the top level, clone the DBTEMPLATE area and name it for your VDB. (Optional: Prune/Configure the DBTEMPLATE area for your needs, adding scripts to the tree and modifying the wrapper scripts for each operation)
$ cd dxhooks
$ ./dxh_dbclone.sh -s DBTEMPLATE -t MYVDB
  1. In the Delphix Admin console, add a hook to your VDB to call dxhooks framework. Use the same operation name in your command as the hook you're creating.
#Example, to run a Configure Clone Hook, where dxhooks is installed under /home/delphix_os/dxhooks
/home/delphix_os/dxhooks/dxh_oracle_hook.sh -o config-clone
  1. Modify the files under dxhooks/MYVDB to control which sql and shell scripts are called
# Example, to modify your Configure Clone Hook to reset passwords to Non-Prod Settings
# vi MYVDB/config-clone/sql/dxh_wrapper_script.sql and Remove the Comment before @${SQLDIR}/dxh_reset_user_password.sql
$ cat MYVDB/config-clone/sql/dxh_wrapper_script.sql
REM sample sql script
REM PROMPT *** executing dxh_rest_user_password.sql ***
@${SQLDIR}/dxh_reset_user_password.sql
REM create user testuser1
REM PROMPT *** executing dxh_custom_create_user.sql ***
REM @${SQLDIR}/dxh_custom_create_user.sql

# Example, to modify your Configure Clone Hook to run datapump import, 
# vi MYVDB/config-clone/scripts/dxh_wrapper_script.sh and Remove the Comment before 
# /softwares/scripts/hooks/dxh_impdp.sh -o ${HOOK_OP} -d '/softwares/scripts/hooks/dumpdir' -p DBTEMPLATE.impdp.delphix.par 

# You might also need to modify the called scripts like dxh_reset_user_password.sql
# You might also need to modify MYVDB/config-clone/scripts shell scripts, and datapump parfiles
  1. You can also add your own SQL and Shell scripts to this framework.

dxhooks Directory Tree

The dxhooks directory contains the shell scripts for the framework and DBTEMPLATE directory is the foundation for cloning VDB templates.

The DBTEMPLATE defines directory structure of the hook operations. Under hook operations directory, it contains 3 sub-directories: scripts, parfile, and sql.

The dxh_oracle_hook.sh is the main wrapper script that is called in the VDB hooks.

The script is executed when it is configured in the hooks based on the hook operation type. It will first execute the dxh_wrapper_script.sql under sql directory then calls the dxh_wrapper_script.sh under scripts directory.

Additional information on VDB hook operations can be found in this link Customizing Oracle Management with Hook Operations

Below are the brief decription of the directories

Directory Description
dxhooks Base directory
DBTEMPLATE VDB template directory
hook operations Hook operations directory (e.g. config-clone,pre-refresh...)
sql Contains the sql script for each hook operation type. dxh_wrapper_script.sql is called on dxh_oracle_hook.sh
scripts Contains the shell scripts for each hook operation type. dxh_wrapper_script.sh is called on dxh_oracle_hook.sh
parfile Contains the expdp/impdp parameter file
logs Contains the scripts log

dxhooks utilities

List of dxhooks utilities can be found here

Clone this wiki locally