8 Backup

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

This section describes the Compute Classic CLI commands you can use to create, delete, and retrieve backup of storage volumes.

Before running the CLI commands described in this section, make sure that you've installed the CLI client and set up the required environment variables as described in Preparing to Use the CLI.

backup add

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

Use this command when you want to immediately create a snapshot of the storage volume specified in a backup configuration object instead of waiting for the next scheduled run.

You can back up a storage volume at regular intervals by creating a backup configuration and specifying the backup interval. See backup-configuration add. To back up a storage volume right away, run the backup add command to back up the storage volume that is specified in a backup configuration.

Prerequisite: Ensure that you have selected a replication policy for your Oracle Cloud Infrastructure Object Storage Classic instance. See Selecting a Replication Policy for Your Service Instance in Using Oracle Cloud Infrastructure Object Storage Classic.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute backup add name backup_configuration_name [--description description]

For help with the parameters and options of this command, run the command with the -h option.

Example

The following example shows how you can immediately create a snapshot of a storage volume which is specified in backup configuration object /Compute-acme/jack.jones@example.com/backupConfigVol1. A snapshot is created immediately with the specified name, /Compute-acme/jack.jones@example.com/vol1-BACKUP-A.

opc -f json compute backup add /Compute-acme/jack.jones@example.com/vol1-BACKUP-A /Compute-acme/jack.jones@example.com/backupConfigVol1 --description 'backup of vol1'

Sample Output

{
 "backupConfigurationName": "/Compute-acme/jack.jones@example.com/backupConfigVol1",
 "bootable": false,
 "description": "backup of vol1",
 "detailedErrorMessage": null,
 "errorMessage": null,
 "name": "/Compute-acme/jack.jones@example.com/vol1-BACKUP-A",
 "runAsUser": "/Compute-acme/jack.jones@example.com",
 "shared": false,
 "snapshotSize": null,
 "snapshotUri": null,
 "state": "SUBMITTED",
 "tagId": "f237131f-89f7-471f-8bf4-802fac186bbf",
 "uri": "https://api-z999.compute.us0.oraclecloud.com:443/backupservice/v1/backup/Compute-acme/jack.jones@example.com/BACKUP-A",
 "volumeUri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol1"
}

The state field in the output changes from SUBMITTED to COMPLETED when snapshot of the storage volume is created. Run the backup get command to monitor the state of the snapshot. The time it takes to create a backup of a storage volume varies depending on the size of the volume. When state changes to COMPLETED, you can note the name of the snapshot from the snapshotUri field. The snapshot is stored in the associated Oracle Cloud Infrastructure Object Storage Classic instance. You can use the snapshot that you have created to restore a storage volume using the restore add command.

backup list

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

Retrieves details of all the backup objects that match the specified query criteria. If you don't specify any query criteria, then details of all the backups that you have permission to view are displayed.

Use the -F option to filter the output for specific attributes. For example, use -F name,state,errorMessage to view the error messages for backup objects that are in the FAILED state.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute backup list [--backup-configuration-name backup-configuration-name]

For help with the parameters and options of this command, run the command with the -h option.

Example

opc -f json compute backup list 

Sample Output

[
{
 "backupConfigurationName": "/Compute-acme/jack.jones@example.com/backupConfigVol1",
 "bootable": false,
 "description": "backup of vol1",
 "detailedErrorMessage": "",
 "errorMessage": "",
 "name": "/Compute-acme/jack.jones@example.com/vol1-BACKUP-A",
 "runAsUser": "/Compute-acme/jack.jones@example.com",
 "shared": false,
 "snapshotSize": "2147483648b",
 "snapshotUri": "/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/0899d2ff58acdb53a975b1c71f12865e4c4c18bc313da9dfcaa5482a91900dc1",
 "state": "COMPLETED",
 "tagId": "f237131f-89f7-471f-8bf4-802fac186bbf",
 "uri": "https://api-z999.compute.us0.oraclecloud.com:443/backupservice/v1/backup/Compute-acme/jack.jones@example.com/BACKUP-A",
 "volumeUri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol1"
}
]

backup get

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

Retrieves details of the specified backup object.

You can use this command to verify whether the add operation was completed successfully and if the snapshot was created. The state field of the backup object changes from SUBMITTED to COMPLETED when snapshot of the storage volume is created. You can use this command to monitor the state of the snapshot. The time it takes to create a backup of a storage volume varies depending on the size of the volume. When state changes to COMPLETED, you can note the name of the snapshot from the snapshotUri field.

You can also use the -F option (for example, -F name,state) to filter the output for specific attributes.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute backup get name

For help with the parameters and options of this command, run the command with the -h option.

Example

opc -f json compute backup get /Compute-acme/jack.jones@example.com/vol1-BACKUP-A

Sample Output

{
 "backupConfigurationName": "/Compute-acme/jack.jones@example.com/backupConfigVol1",
 "bootable": false,
 "description": "backup of vol1",
 "detailedErrorMessage": "",
 "errorMessage": "",
 "name": "/Compute-acme/jack.jones@example.com/vol1-BACKUP-A",
 "runAsUser": "/Compute-acme/jack.jones@example.com",
 "shared": false,
 "snapshotSize": "2147483648b",
 "snapshotUri": "/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/0899d2ff58acdb53a975b1c71f12865e4c4c18bc313da9dfcaa5482a91900dc1",
 "state": "COMPLETED",
 "tagId": "f237131f-89f7-471f-8bf4-802fac186bbf",
 "uri": "https://api-z999.compute.us0.oraclecloud.com:443/backupservice/v1/backup/Compute-acme/jack.jones@example.com/BACKUP-A",
 "volumeUri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol1"
}

backup delete

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

Deletes the specified backup object and its associated snapshot. No response is returned.

You can delete a backup only after the state of the backup object changes to COMPLETED. You can’t delete a backup while a snapshot of the storage volume is being created.

Prerequisite: Ensure that you have selected a replication policy for your Oracle Cloud Infrastructure Object Storage Classic instance. See Selecting a Replication Policy for Your Service Instance in Using Oracle Cloud Infrastructure Object Storage Classic.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute backup delete name

For help with the parameters and options of this command, run the command with the -h option.

Example

opc compute backup delete /Compute-acme/jack.jones@example.com/vol1-BACKUP-A