# DB2 Database Administrator Additional Operations

#### High Availability Disaster Recovery

In a High Availability Disaster Recovery (HADR) environment, the data is continually replicated from the source (primary) database to the target (standby) database. Commvault requires the following configuration in a HADR environment to perform the backup and restore operations:

- Install the DB2 iDataAgent on a primary database server and configured on the CommServe. Install the DB2 Agent on the standby database server and configure it on the CommServe to secure the database transactions in case of a failover.

- Set the VENDOROPT and LOGARCHOPT1 parameters on the standby database.

  In this example, "sample" is the database name

  VENDOROPT:

      db2 update db cfg for $[sample] using VENDOROPT "'CvClientName=$[standby_clientName], CvInstanceName=$[Instance001],
       CvSrcDbName=$[sample],CvSrcClientName=$[primary_clientName],CvSrcDB2InstanceName=$[db2inst2]'"

  LOGARCHOPT1:

      db2 update db cfg for $[SAMPLE] using LOGARCHOPT1 "'CvClientName=$[standby_clientName],CvInstanceName=$[Instance001],
       CvSrcDbName=$[sample],CvSrcClientName=$[primary_clientName],CvSrcDB2InstanceName=$[db2inst2]'"

- Configure LOGARCHMETH1, LOGARCHOPT1 and VENDOROPT parameters on a primary database.

  LOGARCHOPT1:

      db2 update db cfg for $[sample] using LOGARCHOPT1 "'CvClientName=$[primary_clientName],CvInstanceName=$[Instance001]'"

  LOGARCHMETH1:

      db2 update db cfg for $[sample] using LOGARCHMETH1 "'VENDOR:$[/opt/commvault/Base/libDb2Sbt.so]'"

  VENDOROPT:

      db2 update db cfg for $[sample] using VENDOROPT "'CvClientName=$[primary_client_name],CvInstanceName=$[Instance001]'"

Note: If you install the DB2 iDataAgent on primary and standby database servers and configure both on the CommServe computer, then you can only perform backups on the primary database and not on the standby database, because the standby database will always be in a roll forward pending stage.

If a failover happens, the standby database becomes the primary database and only then, can you perform the backups on this standby database. Set the LOGARCHMETH1 parameter and modify the LOGARCHOPT1, VENDOROPT parameters on this newly converted primary database for transaction log management.

When the DB2 application requires a synchronization of transaction logs between the primary and standby servers, it would query the DB2 Agent for the required log files. If the logs are not available in the Commvault log archive directory, it will initiate the command-line log restore jobs.

#### Load Copy Operations in an HADR Environment

The Load Copy Operations are primarily performed on the High Availability Disaster Recovery (HADR) environments. You can use the Commvault library to perform a DB2 load copy operation in a HADR environment.

In a HADR environment, you will have a primary server and a standby server on to which you will move the data using the DB2 Load Copy utility. DB2 load copy operation allows you to efficiently move large quantities of data in to the newly created tables or in to the tables that already contain data. The load copy enables you to write the formatted pages directly in to the database rather than using SQL inserts.

##### Performing a Load Copy Operation in an HADR Environment

Use the following steps to perform a load copy operation in a HADR Environment:

1. Connect to the Primary database.

   Example:

       db2 connect to $[sample]

2. Execute the DB22 command to export the data file.

   Example:

       db2 "export to emp1.del of del select * from employee"

3. Execute the db2 command to perform a Load copy operation.

   View the db2diag.log to verify whether the load operation is successful on the standby server instance.

   Example:

       db2 "load from /home/db2inst2/emp1.del of del replace into empcopy copy yes load '/opt/commvault/Base/libDb2Sbt.so'"

   A restore operation to restore the load copy image of the last incremental backup will automatically commence on the standby DB2 server.

×

Loading...