Db2uRestore resource
You can start a restore operation through the creation of a Db2uRestore resource. To start this restore operation, you need a Db2uCluster or Db2uInstance custom resource in a Ready state and a completed Db2uBackup resource.
Before you begin
Db2uRestore is a Db2 or Db2 Warehouse restore utility. To start a Db2uRestore operation, you
first need these resources:
- A Db2uCluster or Db2uInstance CR in a Ready State
- A completed Db2uBackup operation
Important: If you have already restored a backup, do
not restore another backup made before that restore operation. Doing so can result in issues such as
dropping the database before the next restore and require manual
intervention.
Create a Db2uRestore for a Db2 or Db2 Warehouse backup
Creating the Db2uRestore resource starts the restore operation of your Db2 backup.
You create a Db2uRestore resource through a YAML script. You can edit the YAML script in three 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 Db2uRestore resource by using the Red Hat
OpenShift console,
follow these steps:
- Go to Installed Operators > IBM Db2.
- Click the Db2uRestore tab.
- On this tab page, you can create your Db2uRestore 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: Db2uRestore metadata: name: <name of your db2ubackup> spec: db2uCluster: <name of your existing db2uCluster> db2uBackup: <name of your existing db2uBackup>
Example of the Db2uRestore syntax
The following example shows the command syntax for running the Db2uRestore utility to recover the
Db2uBackup resource
mybackup:
apiVersion: db2ubnr.databases.ibm.com/v1alpha1
kind: Db2uRestore
metadata:
name: myrestore
spec:
db2uCluster: mycluster
db2uBackup: mybackup
For reference on understanding the Db2uRestore command syntax, review these definitions:
- metadata.name is a valid Kubernetes resource name.Note: A restore name cannot be reused, even if the Db2uRestore resource is deleted.
- spec.db2uCluster is an active db2uCluster in the same namespace as the Db2uRestore.
- spec.db2uBackup is a complete db2uBackup in the same namespace as the Db2uRestore.
Db2uRestore status indicator
Check the status of the restore operation by running this
command:
oc get db2urestore <mybackup>
The status indicator for a Db2uRestore operation has four possible statuses:
- InProgress - The restore operation is ongoing.
- Complete - The restore operation was successful.
- InvalidSpec - There is something wrong with the fields of the Db2uRestore CR.
- Error - The restore operation failed.
Delete a Db2uRestore resource
You can delete a Db2uRestore resource by running this
command:
oc delete db2urestore <name of db2urestore>