# Setting DB2 Configuration Parameters

You can configure the primary and standby database by using the DB2 command line interface.

## Procedure

### Primary Database

- Use the DB2 command line interface to configure the following DB2 parameters.

  Substitute the Primary_Database_Name parameter with the name of your primary database.

  Substitute the CVClientName parameter with the Virtual client name.

      db2 update db cfg for $[Primary_Database_Name] using TRACKMOD on
      db2 update db cfg for $[Primary_Database_Name] using LOGARCHMETH1 "'VENDOR:$[software_instalation_location/Base/libDb2Sbt.so]'"
      db2 update db cfg for $[Primary_Database_Name] using LOGARCHOPT1 "'CvClientName=$[Cluster Server Name],CvInstanceName=$[Instance001]'"
      db2 update db cfg for $[Primary_Database_Name] using VENDOROPT "'CvClientName=$[Cluster Server Name],CvInstanceName=$[Instance001]'"
      db2 update db cfg for $[Primary_Database_Name] using LOGINDEXBUILD on
      db2 update db cfg for $[Primary_Database_Name] using INDEXREC RESTART

### Standby Database

- Use the DB2 command line interface to configure the following DB2 parameters.

  Substitute the Primary_Database_Name parameter with the name of your primary database.

  Substitute the CVClientName parameter with the Virtual client name.

      db2 update db cfg for $[Primary_Database_Name] using TRACKMOD on
      db2 update db cfg for $[Primary_Database_Name] using LOGARCHMETH1 "'VENDOR:$[software_instalation_location/Base/libDb2Sbt.so]'"
      db2 update db cfg for $[Primary_Database_Name] using LOGARCHOPT1 "'CvClientName=$[Virtual Client Name],CvInstanceName=$[Instance001]'"
      db2 update db cfg for $[Primary_Database_Name] using VENDOROPT "'CvClientName=$[Virtual Client Name],CvInstanceName=$[Instance001]'"
      db2 update db cfg for $[Primary_Database_Name] using LOGINDEXBUILD on
      db2 update db cfg for $[Primary_Database_Name] using INDEXREC RESTART

## 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

The following table defines the parameters for both scripts.

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

### Using the Script on UNIX Clients

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.

    Db2_config.sh -d $[dbname] -c $[cluster_client_name] [-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] -c $[client_name] [-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.

×

Loading...