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
- 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
- Through the Red Hat® OpenShift® console
- Through the Red Hat OpenShift command-line tool
- Through the command-line tool of a Kubernetes cluster
- Go to Installed Operators > IBM Db2.
- Click the Db2uBackup tab.
- On this tab page, you can create your Db2uBackup resource in two ways:
- By following the on-screen instructions of the form view
- 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
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
oc get db2ubackup <mybackup>
- 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
- 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.
oc delete db2ubackup <name of db2ubackup>