Configuration - DB2 Database Administrator

Table of Contents

Configuring the DB2 Database Parameters

Vendor Parameters

Use the following Vendor parameters to configure and protect the DB2 databases with SnapProtect:

Parameter Description Example
CvInstanceName Name of the installed SnapProtect instance.

This parameter is required only when multiple instances of  SnapProtect are installed.

Instance001
CvClientName Name of the client defined in the CommCell Console. 

This parameter is required only when multiple instances of  SnapProtect are installed.

dbserve1
CvSrcDbName Name of the source database name.

This parameter is required to perform cross database, cross instance, or cross machine restores.

source_db
CvSrcDB2InstanceName Name of the Source DB2 instance name.

This parameter is required to perform cross database, cross instance, or cross machine restores.

db2inst1
CvSrcClientName Name of the Source Client name.

This parameter is required to perform cross database, cross instance, or cross machine restores.

dbserver1
CvDb2RestoreCopyPrec The Copy precedence number as displayed in the storage policy properties.

This parameter is required to restore from a secondary copy.

2

DB2 Parameters

Use the following DB2 parameters to configure and protect the DB2 databases:

Parameter Description Example
LOGARCHMETH1 The SnapProtect library that archives and manages the DB2 database log files. UNIX:

db2 update db cfg for <database name> using LOGARCHMETH1 “'VENDOR:/opt/SnapProtect/Base/libDb2Sbt.so'”

Windows:

db2 update db cfg for <database name> using LOGARCHMETH1
“'VENDOR:C:\NetApp\SnapProtect\Base\Db2Sbt.dll'"

LOGARCHOPT1 Enable the DB2 database to communicate with the SnapProtect storage system in the log archive and retrieve operations.

db2 update db cfg for <database name> using LOGARCHOPT1 "'CvClientName=<ClientName>,CvInstanceName=<SnapProtectInstanceName>'"

VENDOROPT Enable the DB2 database to communicate with the SnapProtect storage system in the backup, restore, or load copy operations.

db2 update db cfg for <database name> using VENDOROPT
"'CvClientName=<ClientName>,CvInstanceName=<SnapProtectInstanceName>'"

TRACKMOD Allow incremental or delta backups.

This is required when you perform incremental or delta backups and restores. If this is not set, you can only perform default of full backups.

db2 update db cfg for <database name> using TRACKMOD on

See Setting the Database Configuration Parameters for more information.

Vendor Library

The following are the default paths of vendor library for various platforms:

Operating System Vendor Library path
AIX <SnapProtect install path>Base64/libDb2Sbt.so’
Solaris <SnapProtect install path>/Base64/libDb2Sbt.so’
zLinux <SnapProtect install path>/Base64/libDb2Sbt.so’
Linux <SnapProtect install path>/Base/libDb2Sbt.so’
HP Itanium <SnapProtect install path>/Base/libDb2Sbt.so’
Windows <SnapProtect install path>\Base\DB2Sbt.dll’”

Use the following  SnapProtect utilities to configure the DB2 Parameters.

  • Db2_config.sh for Unix
  • Db2_config.ps1 for Windows

Note: In a clustered environment, the Db2_config.sh script on Unix and Db2_config.ps1 script on windows will update the DB2 database configuration parameters on the physical node only.

UNIX

The Db2_config.sh is available in SnapProtect_path/iDataAgent on the UNIX client. Use this utility to set the database configurations using SnapProtect DB2 on UNIX iDataAgent. Use this to perform data and log backups on a DB2 Instance. This utility also verifies if the instance user has read/write permissions on the Archive/Retrieve/Audit error directories. You must be a DB2 instance user and need to be added to the UNIX group of SnapProtect to run this utility.

  1. From the DB2 command prompt, navigate to <SnapProtect install path>/iDataAgent to locate the db2_config.sh utility.
  2. Use  the db2_config.sh utility to configure the DB2 database configuration parameters.

    Usage

    Db2_config.sh -d <dbname> [-i <simpana_instance>]

    The Db2_config.sh utility will perform the following:

  • Updates the configuration settings for <dbname> database
  • Verifies whether the currently logged in db2 instance owner has read/write permissions to the Archive/Retrieve directories.

WINDOWS

The script Db2_config.ps1 is located under SnapProtect\iDataAgent location.

The Windows powershell needs to run it from SnapProtect_installation\iDataAgent\Db2_config.ps1.

Use the following steps to run this script from the DB2 command line prompt:

  1. Enable the powerShell script execution on the system:

    powershell Set-ExecutionPolicy Unrestricted

  2. Execute the script:

    powershell.\SnapProtect_installation\iDataAgent\Db2_config.ps1
    Db2_config.ps1 -d <dbname> [-i <SnapProtect_instance>]

  3. Disable the powerShell script execution on the system:

    powershell Set-ExecutionPolicy Restricted

When you modify the LOGARCHMETH1 parameter, you must perform an offline full backup so that DB2 moves the database out of the BACKUP_PENDING state.

Log On to the CommServe

To run command line operations, you must first login to the CommServe.

From Command prompt, navigate to the <Software_Installation_Directory>/Base and run the following command:

-cs <commserve name> -u <user name>

For example, to log on to the CommServe 'server1' with username 'user1', type the following command:

qlogin -cs server1 -u user1

Configuring an Instance Using XML

Available Parameters for Instance Configuration

The following table displays all the parameters you can use with the commands mentioned in the above sections. To add a parameter to your command, use the following syntax: (A example is provided at the end of the table.)

qoperation execute -af <template XML file> -<parameter name> <value>

Parameter Description of Parameter Values
clientName Name of the client computer, as displayed in the CommCell Browser
appName Name of the application.

For Window, use "DB2".

For UNIX, use "DB2 on UNIX"

instanceName Name of the DB2 instance.
description Instance description.  This can include content information, warning notes.
homeDirectory Path to the path to the DB2 application's home directory.
encryptionFlag Option to enable encryption.

Valid values are:

  • ENC_MEDIA_ONLY, to enable Media Only (MediaAgent Side) encryption.
  • ENC_NETWORK_MEDIA, to enable Network and Media (Agent Side) encryption.
  • ENC_NETWORK_ONLY, to enable Network Only ((Agent Encrypts, MediaAgent Decrypts) encryption.
  • ENC_NONE, no encryption.
userAccount The User Account used by the system to access the DB2 application.
domainName (Windows only) Name of the domain server or name of machine.
password The DB2 user password.
userName The DB2 user name.
networkAgents Number of Network Agents.
softwareCompression Option to enable compression on the Client or MediaAgent computer. Valid values are:
  • ON_CLIENT, to enable software compression on the client.
  • ON_MEDIAAGENT, to enable software compression on the MediaAgent.
  • USE_STORAGE_POLICY_SETTINGS, to use the software compression options defined on the storage policy.
  • OFF, to disable software compression.
throttleNetworkBandwidth Enhancing backup performance by reducing network bandwidth overhead.

Valid values are 2-2147483647.

dataBackupStoragePolicy/storagePolicyName Name of the data storage policy for the DB2 data backup.
commandLineStoragePolicy/storagePolicyName Name of the command line storage policy for the DB2 command line backup.
logBackupStoragePolicy/storagePolicyName Name of the log storage policy for the DB2 log backup.
deDuplicationOptions/generateSignature A component of deduplication performed on the client or MediaAgent computer. Valid values are:
  • ON_CLIENT, to enable signature generation on the client.
  • ON_MEDIA_AGENT, to enable signature generation on the MediaAgent.
  • OFF, to disable the signature generation.
overrideDataPathsForCmdPolicy Option to override the library specified in the command line storage policy

Valid values are true/false.

associatedUserGroups User group association with the CommCell.  This must be used with the  "associatedUserGroupsOperationType" parameter.
associatedUserGroupsOperationType Species whether the user group is being added or deleted.   This must be used with the  "associatedUserGroups" parameter. Valid values are:
  • ADD - add the user group
  • DELETE - delete the user group

Adding an Instance

  1. Download the CreateInstance_Template.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command on Windows from the <Software_Installation_Directory>/Base folder after substituting the parameter values.

    qoperation execute -af CreateInstance_Template.xml -instanceName db2instance_name -description 'xxxx' -clientName client_name -appName 'DB2' -commandLineStoragePolicy/storagePolicyName "xxxx" -logBackupStoragePolicy/storagePolicyName "xxxx" -dataBackupStoragePolicy/storagePolicyName "xxxx' -domainName 'xxxx' -userName 'xxxx' -password xxxx -homeDirectory 'xxxxx'

  3. Execute the following command on UNIX from the <Software_Installation_Directory>/Base folder after substituting the parameter values.

    qoperation execute -af CreateInstance_Template.xml -instanceName db2instance_name -description 'xxxx' -clientName client_name -appName 'DB2 on UNIX' -commandLineStoragePolicy/storagePolicyName "xxxx" -logBackupStoragePolicy/storagePolicyName "xxxx" -dataBackupStoragePolicy/storagePolicyName "xxxx' -userName 'xxxx' -password xxxx -homeDirectory 'xxxx'

Getting Instance Properties

  1. Download the GetInstanceProperties_Template.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameter values.

    qoperation execute -af GetInstanceProperties_Template.xml -appName 'DB2' -clientName xxxxx -instanceName xxxxx

Updating an Instance

  1. Download the UpdateInstance_Template.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameter values.

    qoperation execute -af UpdateInstance_Template.xml -instanceName db2instance_name -description 'xxxx' -clientName client_name -appName 'DB2' -commandLineStoragePolicy/storagePolicyName "xxxx" -logBackupStoragePolicy/storagePolicyName "xxxx" -dataBackupStoragePolicy/storagePolicyName "xxxx' -userName 'xxxx' -password xxxx -homeDirectory 'xxxx'

Deleting an Instance

  1. Download the DeleteInstance_Template.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameter values.

    qoperation execute -af DeleteInstance_Template.xml -appName 'DB2' -clientName xxxxx -instanceName xxxxx

Examples

Expand All

Create an Instance

The following example shows the creation of a DB2 Instance that has:

  • Encryption,
  • Deduplication on the client,
  • Software compression using the storage policy settings,
  • A storage policy,
  • A log storage policy,
  • A command line storage policy and
  • The user group test2 being added.

Windows

qoperation execute -af CreateInstance_Template.xml -instanceName db2inst5 -description 'inst - db2_instance' -clientName db2_client -appName 'DB2' -encryptionFlag ENC_NETWORK_AND_MEDIA -generateSignature ON_CLIENT -networkAgents 3 -softwareCompression USE_STORAGE_POLICY_SETTINGS -throttleNetworkBandwidth 250 -commandLineStoragePolicy/storagePolicyName "SP_LIB2" -logBackupStoragePolicy/storagePolicyName "SP4" -dataBackupStoragePolicy/storagePolicyName "SP3" -domainName 'db2_test_domain' -userName 'db2user' -password xxxx -homeDirectory 'E:\DB2V9.7\SQLLIB' -userGroupName test2 -associatedUserGroupsOperationType ADD

UNIX

qoperation execute -af CreateInstance_Template.xml -instanceName db2inst5 -description 'inst - db2_instance' -clientName db2_client -appName 'DB2 on UNIX' -encryptionFlag ENC_NETWORK_AND_MEDIA -generateSignature ON_CLIENT -networkAgents 3 -softwareCompression USE_STORAGE_POLICY_SETTINGS -throttleNetworkBandwidth 250 -commandLineStoragePolicy/storagePolicyName "SP_LIB2" -logBackupStoragePolicy/storagePolicyName "SP4" -dataBackupStoragePolicy/storagePolicyName "SP3" -userName 'db2user' -password xxxx -homeDirectory 'E:\DB2V9.7\SQLLIB' -userGroupName test2 -associatedUserGroupsOperationType ADD

Updating a Data Storage Policy on an Instance on Windows

qoperation execute -af UpdateInstance_Template.xml -instanceName db2instance_name -clientName client_name -appName 'DB2' -dataBackupStoragePolicy/storagePolicyName 'new_storage_policy'

Update the DB2 Home Path on UNIX

qoperation execute -af UpdateInstance_Template.xml -instanceName db2instance_name -clientName client_name -appName 'DB2 on UNIX'-homeDirectory 'Z:\DB2V9.7\SQLLIB'

Update the Command Line Storage Policy on Windows

qoperation execute -af UpdateInstance_Template.xml -instanceName db2instance_name -clientName client_name -appName 'DB2'-commandLineStoragePolicy/storagePolicyName "NEW_CL_POLICY"

Get the Instance Properties for DB2 Instance 'db_unix_instance' on Unix

qoperation execute -af 'GetInstanceProperties_Template.xml' -appName "DB2 on UNIX" -clientName client_test -instanceName 'db_unix_instance'

Delete the DB2 Instance "Unix_Instance2" on Unix

qoperation execute -af 'DeleteInstance_Template.xml' -appName "DB2 on UNIX" -clientName client_test -instanceName 'Unix_Instance2'

Configuring a Backup Set Using XML

Available Parameters for Backup Set Configuration

The following table displays all the parameters you can use with the commands mentioned in the above sections. To add a parameter to your command, use the following syntax: (Some examples are provided at the end of the table.)

qoperation execute -af <template XML file> -<parameter name> <value>

Parameter Parameter Value Description
clientName Name of the client computer.
appName Name of the application. In this case it would be 'DB2 ' or "DB2 on UNIX".
instanceName Name of the DB2 instance
backupsetName Specifies the DB2 Backup Set Name (DB2 database name).

Creating a Backup Set

  1. Download the createBackupSet.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameters values.

    qoperation execute –af createBackupSet.xml -appName "DB2 on Unix" -clientName "my_machine" -instanceName "db2inst7" -backupsetName "TESTDB"

Examples

Creating a Backup Set on UNIX qoperation execute -af createBackupSet.xml -appName "DB2 on Unix" -clientName "my_machine" -instanceName "db2inst7" -backupsetName "TESTDB"

Configuring a Subclient Using XML

Available Parameters for Subclient Configuration

The following table displays all the parameters you can use with the commands mentioned in the above sections. To add a parameter to your command, use the following syntax:

qoperation execute -af <template XML file> -<parameter name> <value>

Parameter Parameter Value Description
appName Name of the application.

For Window, use "DB2".

For UNIX, use "DB2 on UNIX"

clientName Specifies the name of the client as displayed in the CommCell Browser (for example, client1).
instanceName Specifies the name of the DB2 instance (e.g., dbname).
subclientName Specifies the name of the Subclient (e.g. subclient1).
backupsetName Specifies the backup set
encryptionFlag Specifies whether to enable encryption.

Valid values are:

  • ENC_MEDIA_ONLY, to enable Media Only (MediaAgent Side) encryption.
  • ENC_NETWORK_MEDIA, to enable Network and Media (Agent Side) encryption.
  • ENC_NETWORK_ONLY, to enable Network Only (Agent Encrypts, MediaAgent Decrypts) encryption.
  • ENC_NONE, no encryption.
description A general description of the subclient.
enableBackup Option to allow backup.  Set this to 'true'.
networkAgents Number of Network Agents (e.g., 2).  Valid vales are 1-4.
softwareCompression Specifies whether to enable compression on the Client or MediaAgent computer.

Valid values are:

  • ON_CLIENT, to enable software compression on the client
  • ON_MEDIAAGENT, to enable software compression on the MediaAgent
  • USE_STORAGE_POLICY_SETTINGS, to use the software compression options defined on the storage policy
  • OFF, to disable software compression
throttleNetworkBandwidth Enhancing backup performance by reducing network bandwidth overhead.

Valid values are 2-2147483647.

dataBackupStoragePolicy/storagePolicyName Specifies the data backup storage policy for the DB2 data backup.
enableDeduplication Specifies whether to  enable or disable deduplication.

Valid values are true/false.

generateSignature A component of deduplication performed on the client or MediaAgent computer. Valid values are:
  • ON_CLIENT, to enable signature generation on the client.
  • ON_MEDIA_AGENT, to enable signature generation on the MediaAgent.
  • OFF, to disable the signature generation.
isSnapBackupEnabled Specifies whether Snap is enabled.

Valid values are True/False

snapShotEngineName The snap engine name.
snapToTapeProxyToUse/clientName The proxy name.
snapToTapeProxyToUseSource Use source if the proxy is unreachable.

Valid values are True/False

preBackupCommand Specifies the script to run before a backup starts.
postBackupCommand Specifies the script to run after the backup completes.
runPostBackup Specifies whether this process will execute for all attempts to run the phase.

Valid values are YES/NO.

runAs Option to specify the user name who has permissions to run the pre/post process scripts.

Valid values are:

  •  USE_IMPERSONATION, to specify a user with enough privileges to run the scripts.

When you set the value to 'USE_IMPERSONATION', you must provide the user credentials

 -prepostUserName/userName <user name> -prepostUserName/password <password>

  •  USE_LOCAL_SYS_ADMIN, to use the administrator account to run the scripts.
prepostUserName/userName User name of the account that has permission to run the pre or post process script.

This can only be used when "runAs" is set to 'USE_IMPERSONATION'.

prepostUserName/password Password of the account that has permission to run the pre or post process script.

This can only be used when "runAs" is set to 'USE_IMPERSONATION'.

db2BackupMode Specifies the manner in which data file backups for this Subclient will be conducted.

Valid values are:

  • ONLINE_BACKUP, to perform an online backup of the database,
  • OFFLINE_BACKUP, to perform an offline (cold) backup of the database
db2NumberofBuffer Specifies the number of buffers for the backup.

Valid values are 1-1000.

db2BufferSize The size in KB of each buffer

Valid values are 8-1000.

db2Parallelism Specifies the number of table spaces to be read in parallel for restore

Valid values are 0-1000.

db2UseCompression Specifies whether to compress the backup

Valid values are True/False

db2BackupData Backup the data.

Valid values are True/False.

db2BackupType Specifies whether to backup the entire database.  Can only be used when db2BackupData is 'true'.

Valid Values are

  • ENTIRE_DATABASE, backup the entire database
  • DATABASE_SUBSET, backup a subset
db2Content/db2DataFile Specifies the DB2 data to backup.  Can only be used when db2BackupData is 'True and db2BackupType is 'DATABASE_SUBSET'.
db2BackupLogFiles Backup the logs.

Valid values are True/False.

db2DeleteLogFilesAfter Delete the log files.  Can only be set when the 'backupLogFiles' parameter is 'True'.

Valid values are True/False.

db2DisableSwitchCurrentLog Set Disable Switch Current Log

This can be set if db2BackupLogFiles is 'True' and db2BackupData is 'False'.

Valid values are True/False.

db2SubclientProp/numberOfBackupStreams Specifies the maximum number of data backup streams.

Valid values are 1-50.

Creating a Subclient

  1. Download the CreateSubclient.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameters values.

    qoperation execute -af C:\XML\create_subclient_template.xml -appName "DB2" -clientName "xxxxx" -instanceName "xxxxx" -backupsetName "xxxxx" -subclientName "xxxxx"

Getting a Subclient

  1. Download the GetSubclient.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameters values.

    qoperation execute -af C:\XML\get_subclient_template.xml -appName "DB2" -clientName "xxxxx" -instanceName "xxxxx" -backupsetName "xxxxx" -subclientName "xxxxx"

Modifying a Subclient

  1. Download the UpdateSubclient.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameters values.

    qoperation execute -af C:\XML\update_subclient_template.xml -appName 'DB2' -clientName 'client1' -instanceName 'dbname' -subclientName 'subclient1' -dataBackupStoragePolicy/storagePolicyName 'data_sp'

Deleting a Subclient

  1. Download the DeleteSubclient.xml file and save it on the computer from where the command will be executed.
  2. Execute the following command from the <Software_Installation_Directory>/Base folder after substituting the parameters values.

    qoperation execute -af C:\XML\delete_subclient_template.xml -appName 'DB2' -clientName 'client1' -instanceName 'dbname' -subclientName 'subclient1'

Examples

Expand All

Create a subclient for the database and logs (full subclient)

Windows

qoperation execute -af C:\XML\create_subclient_template.xml xml -appName "DB2" -clientName "db2win" -instanceName "DB2" -backupsetName "testdb" -subclientName "datalog" -dataBackupStoragePolicy/storagePolicyName ‘SP1'

UNIX

qoperation execute -af C:/XML/create_subclient_template.xml xml -appName "DB2" -clientName "db2unix" -instanceName "DB2 on UNIX" -backupsetName "testdb" -subclientName "datalog" -dataBackupStoragePolicy\storagePolicyName ‘SP1'

Create a log only subclient

To create a log backup only Subclient, use the following:

  • db2BackupData: set to False

Windows

qoperation execute -af C:\XML\create_subclient_template.xml xml -appName "DB2" -clientName "db2win" -instanceName "DB2" -backupsetName "testdb" -subclientName "logsonly1" -db2BackupData False

UNIX

qoperation execute -af C:/XML/create_subclient_template.xml xml clientName "db2unix" -instanceName "db2inst1" -backupsetName "testdb" -subclientName "logsonly1" -db2BackupData False