---
title: OpenShift API for Data Protection (OADP) restore use case
---

# OpenShift API for Data Protection (OADP) restore use case {#oadp-use-cases-restore}

Following is a use case for using OADP to restore a backup to a different namespace.

## Restoring an application to a different namespace using OADP {#oadp-usecase-restore_oadp-use-cases-restore}

Restore a backup of an application by using OADP to a new target namespace, `test-restore-application`. To restore a backup, you create a restore custom resource (CR) as shown in the following example. In the restore CR, the source namespace refers to the application namespace that you included in the backup. You then verify the restore by changing your project to the new restored namespace and verifying the resources.

**Prerequisites**

- You installed the OADP Operator.
- You have the backup of an application to be restored.

**Procedure**

1. Create a restore CR as shown in the following example:

   ```yaml
   apiVersion: velero.io/v1
   kind: Restore
   metadata:
     name: test-restore
     namespace: openshift-adp
   spec:
     backupName: <backup_name>
     restorePVs: true
     namespaceMapping:
       <application_namespace>: test-restore-application
   ```

   where:

   `test-restore`
   :   Specifies the name of the restore CR.

   `<backup_name>`
   :   Specifies the name of the backup.

   `<application_namespace>`
   :   Specifies the target namespace to restore to. `namespaceMapping` maps the source application namespace to the target application namespace. `test-restore-application` is the name of target namespace where you want to restore the backup.
2. Apply the restore CR by running the following command:

   ```terminal
   $ oc apply -f <restore_cr_filename>
   ```

**Verification**

1. Verify that the restore is in the `Completed` phase by running the following command:

   ```terminal
   $ oc describe restores.velero.io <restore_name> -n openshift-adp
   ```
2. Change to the restored namespace `test-restore-application` by running the following command:

   ```terminal
   $ oc project test-restore-application
   ```
3. Verify the restored resources such as persistent volume claim (pvc), service (svc), deployment, secret, and config map by running the following command:

   ```terminal
   $ oc get pvc,svc,deployment,secret,configmap
   ```

   ```terminal {title="Example output"}
   NAME                          STATUS   VOLUME
   persistentvolumeclaim/mysql   Bound    pvc-9b3583db-...-14b86

   NAME               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
   service/mysql      ClusterIP   172....157     <none>        3306/TCP   2m56s
   service/todolist   ClusterIP   172.....15     <none>        8000/TCP   2m56s

   NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
   deployment.apps/mysql   0/1     1            0           2m55s

   NAME                                         TYPE                      DATA   AGE
   secret/builder-dockercfg-6bfmd               kubernetes.io/dockercfg   1      2m57s
   secret/default-dockercfg-hz9kz               kubernetes.io/dockercfg   1      2m57s
   secret/deployer-dockercfg-86cvd              kubernetes.io/dockercfg   1      2m57s
   secret/mysql-persistent-sa-dockercfg-rgp9b   kubernetes.io/dockercfg   1      2m57s

   NAME                                 DATA   AGE
   configmap/kube-root-ca.crt           1      2m57s
   configmap/openshift-service-ca.crt   1      2m57s
   ```
