// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/cli-tools/oadp-cli-plugin.adoc

:_mod-docs-content-type: REFERENCE
[id="oadp-cli-admin-restores_{context}"]
= Restore management commands

[role="_abstract"]
You can use the {oadp-short} command-line interface (CLI) to create, view, describe, and delete restores.

[id="oadp-cli-admin-restores-prereqs_{context}"]
== Prerequisites

* The {oadp-short} CLI plugin is installed and configured in admin mode.
* You are logged in to the {product-title} cluster as a user with `cluster-admin` privileges.
* A completed backup exists to restore from.

[id="oadp-cli-admin-restores-create_{context}"]
== Restore creation command

To create a restore from an existing backup, use the following command:

[source,terminal]
----
$ oc oadp restore create <restore_name> [flags]
----

.Flags for the `oc oadp restore create` command
[cols="1,3",options="header"]
|===
|Flag |Description

|`--from-backup`
|The name of the backup to restore from.

|`--from-schedule`
|The name of the schedule to restore from. This flag uses the most recent backup.

|`--include-namespaces`
|The namespaces to include in the restore. The default value is `*` (all namespaces).

|`--exclude-namespaces`
|The namespaces to exclude from the restore.

|`--include-resources`
|The resources to include in the restore. You can specify simple kind names, for example, `deployments,services`, or you can use the `resource.group` format for disambiguation, for example, `deployments.apps`. The default value is `*` (all resources).

|`--exclude-resources`
|The resources to exclude from the restore. This flag uses the same format as the `--include-resources` flag.

|`--selector`, `-l`
|A label selector to filter resources.

|`--or-selector`
|An OR combination of label selectors.

|`--include-cluster-resources`
|Specifies whether to include cluster-scoped resources.

|`--restore-volumes`
|Specifies whether to restore persistent volume (PV) data from snapshots.

|`--preserve-nodeports`
|Specifies whether to preserve NodePort service port assignments.

|`--item-operation-timeout`
|The timeout for asynchronous plugin operations.

|`--request-timeout`
|The timeout for the request to the Kubernetes API server.
|===

.Example of the restore creation command
[source,terminal]
----
$ oc oadp restore create my-restore \
    --from-backup my-backup \
    --include-namespaces my-namespace
----

[id="oadp-cli-admin-restores-list_{context}"]
== Restore listing command

To list all restores, use the following command:

[source,terminal]
----
$ oc oadp restore get [<restore_name>] [flags]
----

.Flags for the `oc oadp restore get` command
[cols="1,3",options="header"]
|===
|Flag |Description

|`-o`
|The output format. Supported values are `json` and `yaml`.
|===

[id="oadp-cli-admin-restores-describe_{context}"]
== Restore description command

To view the details of a restore, use the following command:

[source,terminal]
----
$ oc oadp restore describe <restore_name> [flags]
----

.Flags for the `oc oadp restore describe` command
[cols="1,3",options="header"]
|===
|Flag |Description

|`--details`
|Specifies whether to display additional details in the output.
|===

[id="oadp-cli-admin-restores-logs_{context}"]
== Restore logs command

To view the logs for a restore, use the following command:

[source,terminal]
----
$ oc oadp restore logs <restore_name>
----

[id="oadp-cli-admin-restores-delete_{context}"]
== Restore deletion command

To delete a restore, use the following command:

[source,terminal]
----
$ oc oadp restore delete <restore_name> [flags]
----

.Flags for the `oc oadp restore delete` command
[cols="1,3",options="header"]
|===
|Flag |Description

|`--confirm`
|Specifies whether to confirm the deletion without prompting.
|===
