Creating backups of DB2 HADR databases

You can create online backups of the DB2 databases on the current DB2 HADR primary.

About this task

To determine the current primary, use the knife os manage services status command to see the status of one of the HA controllers. Look for the ibm-os-db2hadr resources.
ibm-os-db2hadr    (ocf::ibm-openstack:db2hadr):   Master vs181.example.com
ibm-os-db2hadr    (ocf::ibm-openstack:db2hadr):   Started vs184.example.com
ibm-os-db2hadr    (ocf::ibm-openstack:db2hadr):   Started vs182.example.com
ibm-os-db2hadr    (ocf::ibm-openstack:db2hadr):   Started vs183.example.com
Masters: [ vs181.example.com ]
Slaves: [ vs182.example.com vs183.example.com vs184.example.com]
Stopped: [ vs185.example.com ]
The node that is identified as Master is the current DB2 HADR primary.

Create a backup of the DB2 databases by completing the following steps:

Procedure

  1. Create a backup directory (/tmp/backups for example):
    # mkdir /tmp/backups
    # chown db2inst1 /tmp/backups
    Note: The IBM Cloud Manager with OpenStack deployment and update process creates the /home/db2inst1/backup directory to create temporary backups for initializing new HA controllers. Do not create your backups in this directory. They will be deleted the next time the deployment or update processes are run.
  2. Create a backup of the DB2 HADR primary database.
    # su - db2inst1
    $ db2 backup db ceilodb2 online to /tmp/backups compress
    Backup successful. The timestamp for this backup image is : 20150603151854

    The backup files are in the directory that you specified and have names like: CEILODB2.0.db2inst1.DBPART000.20150603151854.001

  3. Repeat the previous steps for each database.