Db2uBackup resource

You can start a backup operation through the creation of a Db2uBackup resource. To start this backup operation, you need a Db2uCluster or Db2uInstance custom resource in a Ready state.

Before you begin

Creating the Db2uBackup resource starts the Db2 or Db2 Warehouse backup operation. The Db2® operator manages the lifecycle of this resource. The operator also reports the completion status of the resource and contains helpful logs about the status of the backup operation.

You need a Db2uCluster or Db2uInstance custom resource (CR) deployment in a Ready state to create a Db2uBackup resource.

Types of database backup operations

Three types of database backup operations are supported:
  • Full offline backup
  • Full online backup
  • Incremental online backup

Online backups require that the TRACKMOD configuration parameter to be set to Yes. For more information on backup types, see Backing up and restoring a database, schema, or table.

Create a Db2uBackup resource for database backups

You create a Db2uBackup custom resource through a YAML script. You can do this in several ways:
  • Through the Red Hat® OpenShift® console
  • Through the Red Hat OpenShift command-line tool
  • Through the command-line tool of a Kubernetes cluster
To create a Db2uBackup resource by using the Red Hat OpenShift console, follow these steps:
  1. Go to Installed Operators > IBM Db2.
  2. Click the Db2uBackup tab.
  3. On this tab page, you can create your Db2uBackup resource in two ways:
    1. By following the on-screen instructions of the form view
    2. By entering and running a YAML script that is completed with information about your setup:
      apiVersion: db2ubnr.databases.ibm.com/v1alpha1
      kind: Db2uBackup
      metadata:
        name: <name of your db2ubackup>
      spec:
        db2uName: <name of your existing db2ucluster | db2uinstance>
        databaseBackup:
          dbName: <name of your database>
          type: <offline | online | incremental>
          backupTarget:
            vendor: "disk"

Example of the Db2uBackup syntax

This example output shows the command syntax for running the Db2uBackup utility to back up the BLUDB database that resides in the Db2uCluster mycluster:
apiVersion: db2ubnr.databases.ibm.com/v1alpha1
kind: Db2uBackup
metadata:
  name: mybackup
spec:
  db2uName: mycluster
  databaseBackup:
    dbName: BLUDB
    type: offline
    backupTarget:
      vendor: disk

For reference on understanding the Db2uBackup command syntax, review these definitions:

  • metadata.name is a valid Kubernetes resource name.
    Note: A backup name cannot be reused, even if the Db2uBackup resource is deleted.
  • spec.db2uCluster is an active db2uCluster in the same namespace as the Db2uBackup.
  • spec.db2uCluster is an active db2uCluster in the same namespace as the Db2uBackup.
  • spec.databaseBackup.dbName is the name of your database.
  • spec.databaseBackup.type is one of the supported types.

Db2uBackup status indicator

Check the status of the backup operation by running this command:
oc get db2ubackup <mybackup>
The status indicator for a Db2uBackup operation has five possible statuses:
  • InProgress - The backup operation is ongoing.
  • Complete - The backup operation was successful.
  • InvalidSpec - There is something wrong with the fields of the Db2uBackup CR.
  • Error - The backup operation failed.
  • Expired - The backup is no longer available.

Delete a Db2uBackup resource

Before you delete a Db2uBackup resource, consider these restrictions:
  • A deleted Db2uBackup resource cannot be restored.
  • If a completed Db2uBackup resource is deleted, the underlying backup image on disk is not deleted.
  • Do not attempt to delete database-level backups manually.
  • Deleting a Db2uBackup resource is not recommended unless the backup status indicates InvalidSpec, Error, or Expired.
You can delete a Db2uBackup resource by running this command:
oc delete db2ubackup <name of db2ubackup>