Add a HADR database resource to the cluster domain

You can add a database resource to an HADR Db2 instance running on a Pacemaker-managed Linux cluster by using the Db2 Cluster Manager (db2cm) utility.

Before you begin

Important: To run the db2cm utility as the root user, ensure the DB2INSTANCE environment variable is set to the instance owner.
The following prerequisites must be met before proceeding with the rest of the procedure:
  • The target database must exist in the current instance.
  • The HADR_PEER_WINDOW value must be set.

About this task

The following placeholders are used in the command statements throughout this procedure:
  • <database_name> is the name of the Db2 database on the HADR database resource.
  • <instance_name> is the name of the Db2® instance on the cluster

Procedure

  1. As the root user, create the database resource for your Db2 instance:
    ./sqllib/bin/db2cm -create -db <database_name> -instance <instance_name>
  2. As the root user, verify that the resource is created successfully:
    ./sqllib/bin/db2cm -status

Examples

The following example shows the command syntax and output from adding a database resource called SAMPLE to the Db2 instance, db2inst1 (see step 1):
[db2inst1@pcmk-test-srv-1 ~]$ db2cm -create -db GT -instance db2inst1
Database resource 'GT' created successfully.
The following example shows the command syntax and output from verifying that the database resource is added to the cluster domain (see step 2):
[db2inst1@pcmk-test-srv-1 ~]$ db2cm -status
2024-12-06-12.12.02
-------------------
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: pcmk-test-srv-2 (version 2.1.9-1.db2pcmk.el9-3479fba) - partition with quorum
* Last updated: Fri Dec 6 12:12:02 2024 on pcmk-test-srv-1
* Last change: Fri Dec 6 12:09:51 2024 by db2inst1 via db2inst1 on pcmk-test-srv-1
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ pcmk-test-srv-1 pcmk-test-srv-2 ]
Full List of Resources:
* db2_ethmonitor_pcmk-test-srv-1_eth1 (ocf:heartbeat:db2ethmon): Started pcmk-test-srv-1
* db2_ethmonitor_pcmk-test-srv-2_eth1 (ocf:heartbeat:db2ethmon): Started pcmk-test-srv-2
* db2_pcmk-test-srv-2_db2inst1_0 (ocf:heartbeat:db2inst): Started pcmk-test-srv-2
* db2_pcmk-test-srv-1_db2inst1_0 (ocf:heartbeat:db2inst): Started pcmk-test-srv-1
* Clone Set: db2_db2inst1_db2inst1_GT-clone [db2_db2inst1_db2inst1_GT] (promotable):
\* Promoted: \[ pcmk-test-srv-1 \] \* Unpromoted: \[ pcmk-test-srv-2 \]
QDevice Information:
* The current user does not have root permission to obtain qdevice information
The db2_db2inst1_db2inst2_SAMPLE-clone is the new database resource created for the SAMPLE database in the cluster domain.