# Configuration - DB2 Agent

#### Configuration - Database Administrator Configuration

Perform the following for DB2 database administrators that perform backup and restore operations:

1. A DB2 user must have SYSADM, SYSCTRL, or SYSMAINT and DBADM privileges to run backup and restore operations. For more details, refer to the IBM Knowledge Center website.

   Initially, the user account credentials are provided during the instance configuration after the installation of the agent. You can subsequently change the user account information to access the DB2 database and application at the database instance level whenever the credentials are updated. The user which is specified at the DB2 instance level property can manage all databases under the DB2 instance; however, you can specify separate DB2 users for specific databases at the backup set level.

   Note

   The DBADM privilege is required when the user only has SYSMAINT privilege, as DBADM privilege is required to connect to the database and fetch the tablespace, containers, storage group and other relevant information. For more information, refer to System maintenance authority (SYSMAINT) and Database administration authority (DBADM).

2. Configure a Command Center user with agent management capabilities for the database administrator.

#### DB2 Parameter Configuration

You must update the following DB2 database parameters to configure and protect the DB2 database with Commvault:

LOGARCHMETH1

Use this parameter to specify the Commvault library that will be used to archive and manage the DB2 database log files.

LOGARCHOPT1

Use this parameter to enable the DB2 to communicate with Commvault storage system during the Log archive and retrieve operations.

VENDOROPT – vendor

Use this parameter to enable the DB2 to communicate with Commvault storage system during backup, restore, or load copy operations.

TRACKMOD

Enable this parameter to allow the incremental/delta backups.

##### Automatically Updating DB2 Parameters

You can automatically update DB2 parameters by using the Db2_config.sh script on Unix and the Db2_config.ps1 script on Windows to perform backups and restores.

The following DB2 parameters are modified:

- LOGARCHMETH1

- LOGARCHOPT1

- VENDOROPT

- LOGARCHMETH2 to OFF

- TRACKMOD to ON

Note: In a clustered environment, the Db2_config.sh script on Unix or the Db2_config.ps1 script on Windows updates the DB2 database configuration parameters on the physical node only. You must manually update the CvClientName from the physical node name to the VM client name for the LOGARCHOPT1 and VENDOROPT parameters.

The following table defines the parameters for both scripts.

Parameter | Description
--- | ---
dbname | The name of the DB2 database. This is required.
Commvault_Instance | The name of the Commvault instance. This is optional. When you do not specify this parameter, the Commvault software uses Instance001.

UNIX

This script is available in Commvault_path/iDataAgent on the UNIX client. This script can be used to set the DB2 database configurations to use Commvault DB2 on UNIX iDataAgent to perform a data backup on a single node DB2 Instance, log backup and log archival. This script also checks if the instance user has read/write permissions to the Archive, Retrieve, and Audit error directories. You must be a DB2 instance user and need to be added to the UNIX group of Commvault to run this script.

Synopsis

    Db2_config.sh -d $[dbname] [-i $[Commvault_instance]]

1. Go to the DB2 Agent directory to locate the Db2_config.sh utility.

2. On the command line, type the following command.

       Db2_config.sh -d $[dbname] [-i $[Commvault_instance]]

Example:

    # su - db2inst1
     $ cd /opt/Commvault/iDataAgent
     $ ./Db2_config.sh -d $[testdb] -i $[Instance001]
     OPTIND is now 5
     DBNAME=$[testdb] INSTANCE=$[Instance001]
     Input:: DBNAME=$[testdb] INSTANCE=$[Instance001]
     set_db_params
     check_dir
     get_db2_paths
     /u01/database/db2/GDB2Archive
     /u01/database/db2/GDB2Audit
     /u01/database/db2/GDB2Retrieve
     /u01/database/db2/GDB2Archive is accessible
     /u01/database/db2/GDB2Retrieve is accessible
     /u01/database/db2/GDB2Audit is accessible
     get_base_dir
     Base directory: /opt/commvault/Base
     DB2 User:$[db2inst1]
     DB2 Home: /home/db2inst1
     DB2SYSC Path: /home/db2inst1/sqllib/adm/db2sysc
     get_client_name
     Client Name=$[ggux18]
     Executing:: db2 update db cfg for $[testdb] using LOGARCHMETH1 VENDOR:/opt/Commvault/Base/libDb2Sbt.so
     DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
     Executing:: db2 update db cfg for $[testdb] using LOGARCHOPT1 CvClientName=$[ggux18],CvInstanceName=$[Instance001]
     DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
     Executing:: db2 update db cfg for $[testdb] using VENDOROPT CvClientName=$[ggux18],CvInstanceName=$[Instance001]
     DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
     Executing:: db2 update db cfg for $[testdb] using LOGARCHMETH2 OFF
     DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
     Executing:: db2 update db cfg for $[testdb] using TRACKMOD ON
     DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
     <<<<<<<<<ENDED>>>>>>>>>
     $

If you update the LOGARCHOPT1 parameters, you must restart the database after running this script.

Windows

This script is available in Commvault_path\Base on Windows clients. This script can be used to set the DB2 database configurations to use Commvault DB2 on the Windows iDataAgent to perform a data backup on a single node DB2 Instance, log backup and log archival. This script also checks if the instance user has read and write permissions to the Archive, Retrieve, and Audit error directories. You must be a DB2 instance user to run this script.

Synopsis

    Db2_config.ps1 -d $[dbname] [-i $[Commvault_instance]]

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

1. On the Windows client computer command line, type the following command.

       qlogin -cs $[commserve_name] -u $[commcell_user_name] -p $[commcell_login_password]

2. Run the Windows PowerShell from the DB2 command prompt window.

3. Enable PowerShell script execution on the system:

       Set-ExecutionPolicy Unrestricted

4. In the Commvault_path\Base directory, at the PowerShell prompt, type the following command.

       Db2_config.ps1 -d $[dbname]

5. At the PowerShell prompt, disable the PowerShell script execution on the system:

        Set-ExecutionPolicy Restricted

###### Interactively Updating the DB2 Parameters

Before you change any configuration parameter, ensure that no applications are currently using the affected database. Also, be sure to consult your database administrator regarding the business requirements for the database.

Update the database configuration parameters when the DB2 agent is installed on a cluster or multiple instances of Commvault are installed.

#### DB2 Initial Configuration on the Command Center

You must perform the following tasks before you perform your first backup.

1. Configure a storage retention policy for backups.

2. Discover the DB2 instances.

3. Update the DB2 instances with the appropriate credentials for accessing the DB2 application.

4. Configure the subclient storage policies.

×

Loading...