This topic describes how to link a DB2 staging dSource.
Prerequisites
- Be sure that the source and staging instances meet the host requirements and the databases meet the container requirements described in Requirements for DB2 Hosts and Databases.
Source Database Preparation
Instance Owner Permissions
Delphix uses the DB2 instance owner account on the dSource for many things, including verifying the data inside the databases. For ingesting database on the staging server with different instance we need permissions on the source database to do restore on the staging server. For example in the source if we have an instance named auto1051 and database name delphix and if we want to create a dSource on the auto1052 instance on staging server then you must explicitly grant DBADM and SECADM to the dSource instance auto1052 on the source instance using the following steps:
- Connect to the source databases as the source instance owner.
- connect to <DB_NAME> user <INSTANCE_OWNER>
- Issue database grant command
- grant DBADM, SECADM on database to user <DSOURCE_INSTANCE_OWNER>
- Repeat step 2 for every database to be included in the dSource, on the corresponding source database.
- Connect to the source databases as the source instance owner.
Determine if your dSource will be a non-HADR instance, an HADR single standby instance, or an HADR multiple standby instance. Non-HADR dSources can only be updated via a full dSource resync from a newer backup file
Non-HADR Database
- See "Instance Owner Permissions" section above.
Ensure that the source database has the necessary user permissions for the provisioned VDBs as described in Database Permissions for Provisioned DB2 VDBs
HADR Single Standby Database
- All items in Non-HADR Database section above.
- The following database configuration settings must be set:
- update db cfg for <DB_NAME> using HADR_LOCAL_HOST <PRIMARY_IP> HADR_LOCAL_SVC <PRIMARY_PORT > immediate
- update db cfg for <DB_NAME> using HADR_REMOTE_HOST <STANDBY_IP> HADR_REMOTE_SVC <STANDBY_PORT> immediate
- update db cfg for <DB_NAME> using HADR_REMOTE_INST <STANDBY_INSTANCE_NAME> immediate
- update db cfg for <DB_NAME> using HADR_SYNCMODE SUPERASYNC immediate
- If database configuration parameter LOGINDEXBUILD is set to OFF, do the following:
- update db cfg for <DB_NAME> using LOGINDEXBUILD ON
- Force off all connections to the database and reactivate the database
- If database configuration parameter LOGARCHMETH1 is set to OFF, do the following:
- update db cfg for <DB_NAME> using LOGARCHMETH1 XXXX (must be a valid log archiving method)
- Take an offline backup
- If LOGARCHMETH1 points to a third-party backup server (i.e. TSM or Netbackup) define LOGARCHMETH2 to disk
- update db cfg for <DB_NAME> using LOGARCHMETH2 DISK:<full path to archive log directory>
- Log files in the directory must be available from the time of the backup until the restore has successfully completed on the dSource.
- update db cfg for <DB_NAME> using LOGARCHMETH2 DISK:<full path to archive log directory>
- db2 start hadr on db <DB_NAME> as primary by force
- Take a full online backup as defined in the "Backup Source Database" section below.
- Record the following information, as it must be entered on the Delphix Engine while creating the dSource.
- HADR Primary hostname
- HADR Primary SVC
- HADR Standby SVC (auxiliary standby port)
HADR Multiple Standby Databases
This assumes a single standby database HADR setup already exists. The existing standby will be referred to as the main standby. The new delphix standby will be referred to as the auxiliary standby.
- The following database configuration settings must be set on the primary database:
- update db cfg for <DB_NAME> using HADR_SYNCMODE <SYNC MODE> immediate – set whichever sync mode you wish to use on your main standby.
- update db cfg for <DB_NAME> using HADR_TARGET_LIST "<MAIN_STANDBY_IP:MAIN_STANDBY_PORT|AUXILIARY_STANDBY_IP:AUXILIARY_STANDBY_PORT>" immediate
- You may have up to two auxiliary standbys defined separated by a '|'; one of which must be the delphix dSource.
stop hadr on db <DB_NAME>
- start hadr on db <DB_NAME> as primary by force
- Take a full online backup as defined in the "Backup Source Database" section below. While this backup is running, you may continue with step 5.
- The following database configuration settings must be set on the existing main standby database:
- update db cfg for <DB_NAME> using HADR_SYNCMODE <same mode as defined in 1.a above.> – It must be the same value used for primary database.
- update db cfg for <DB_NAME> using HADR_TARGET_LIST "<PRIMARY_IP:PRIMARY_PORT|MAIN_STANDBY_IP:MAIN_STANDBY_PORT>"
- stop hadr on db <DB_NAME>
- start hadr on db <DB_NAME> as standby
- Record the following information, as it must be entered on the Delphix Engine while creating the dSource (the auxiliary standby database):
- HADR Primary hostname
- HADR Primary SVC
- HADR Standby SVC (auxiliary standby port)
- HADR_TARGET_LIST <PRIMARY_IP:PRIMARY_PORT|MAIN_STANDBY_IP:MAIN_STANDBY_PORT>
- The following database configuration settings must be set on the primary database:
Backup Source Database
New Feature: Source Database with Raw DEVICE type Storage
Several users use raw device-based tablespaces for source DB2 databases. To leverage these environments with Delphix, Delphix has built a workflow using DB2s native tools that allow Delphix to discover and convert a raw device-based tablespace into an automatic storage-based tablespace during ingestion. Once the data is ingested into staging, customers will be able to provision VDBs of the automatic storage-based database.
In order to complete the linking process, the Standby dSource must have access to a full backup of the source DB2 databases on disk. This should be a compressed online DB2 backup and must be accessible to the dSource instance owner on disk. Delphix is currently not set up to accept DB2 backups taken using third-party sources such as Netbackup or TSM. Both HADR and Non-HADR backups must also include logs.
Example backup command: db2 backup database <DB_NAME> online compress include logs
Best Practices for Taking a Backup
The following best practices can help improve backup and restore performance:
Compression should be enabled
Following parameters should be optimally configured:
Utility Heap Size (UTIL_HEAP_SZ)
No. of CPUs
No. of Table Spaces
Extent Size
Page Size
Parallelism & Buffer configuration may be used to improve the backup performance. Parameters that should be configured are :
Parallelism
Buffer Size
No. of Buffers
More information about backup best practices is available in IBM Knowledge Center
Procedure
- Login to the Delphix Management Application.
- On the Databases tab of the Environment Management screen, add a source config against discovered staging instance.
Then, click Manage.
Select Datasets.
Click the Plus (+) icon and select Add dSource, you’ll get a list of available source configs using which you can go for dsource creation.
In the Add dSource wizard, select the required source configuration.
If you are working with an HADR setup, please leave the HADR checkbox checked.
The database name is mandatory and must be unique for a given instance. This is the name that the database was on the instance it was restored from.
Enter the complete Backup Path where the database backup file resides. If no value is entered, the default value used is the instance home directory. If there are multiple backup files for a database on the backup path, the most current one will be used.
Enter the Log Archive Method1 you wish to use for the database. If no value is entered, the default value used is DISK:/mountpoint/dbname/arch.
Optionally, users can set the database configuration parameters during the linking operation in the Config Settings section.
Optionally, users can provide a bash script as a toolkit defined hook.
This hook will be executed after data ingestion but before snapshot operation.If the dSource is to use HADR please enter the following fields. If it will not use HADR skip ahead to step 13.
For more information about HADR please view Linking a dSource from a DB2 Database: An Overview.a. Enter a fully qualified HADR Primary Hostname. This is a required field for HADR and must match the value set for HADR_LOCAL_HOST on the master.
b. Enter the port or /etc/services name for the HADR Primary SVC. This is a required field for HADR and uses the value set for HADR_LOCAL_SVC on the master.
c. Enter the port or /etc/services name for the HADR Standby SVC. This is a required field for HADR and uses the value set for HADR_REMOTE_SVC on the master.
Click Next.
Enter a dSource name and select a group for your dSource. Adding a dSource to a dataset group lets you set Delphix Domain user permissions for that database and its objects, such as snapshots.
Click Next.
You will get the Data Management section where you need to specify staging environment and user which will be used for dsource creation.
Set the Staging Environment to be the same as the dSource host.
Select the Staging Environment User to be the same as the instance owner of the dSource instance.
Changing the Environment User
If you need to change or add an environment user for the dSource instance, see Managing DB2 Users and Instance Owners.Then, click Next and you’ll get the Policies section. Set the desired Snapsync Policy for the dSource. For more information on policies see Advanced Data Management Settings for DB2 dSources.
Click Next.
Specify any desired pre- and post-scripts. For details on pre- and post-scripts, refer to Customizing DB2 Management with Hook Operations.
Click Next.
Review the dSource Configuration and Data Management information in the Summary section.
Click Submit.
The Delphix Engine will initiate two jobs to create the dSource: DB_Link and DB_Sync. You can monitor these jobs by clicking Active Jobs in the top menu bar, or by selecting System > Event Viewer. When the jobs have completed successfully, the database icon will change to a dSource icon on the Environments > Host > Databases screen, and the dSource will also appear in the list of Datasets under its assigned group.
The dSource Configuration Screen
After you have created a dSource, the dSource Configuration tab allows you to view information about it and make modifications to its policies and permissions. In the Datasets panel, select the dSource you wish to examine. You can now choose the configuration tab to see information such as the Source files, Data Management configuration, and Hook Operations. For more information, see Advanced Data Management Settings for DB2 dSources.