Managing Backup Policies

The Block Volume service enables you to perform volume backups and volume group backups automatically according to a schedule that is defined in a backup policy. The backup policy also specifies how long to retain the backup.

You can use one of the backup policies that is defined by Oracle and available in every compartment, or you can create your own user defined backup policy as described in Creating a Backup Policy. For descriptions of the Oracle defined backup policies, see "Volume Backups and Clones" in the Block Volume Storage Overview chapter in the Oracle Private Cloud Appliance Concepts Guide. You cannot modify policies that are provided by Oracle. You cannot use an Oracle defined backup policy to back up a volume group.

All backups are full backups.

A particular resource cannot be assigned more than one backup policy. A particular policy can have more than one backup schedule.

Schedule notes:

These notes apply to both user defined and Oracle defined backup policies.

  • Start time: A backup might not start at its scheduled start time. A backup can be delayed for hours if the system is very busy.

  • Conflicts: The Block Volume service will not run more than one scheduled backup of a particular resource in one day. If more than one backup is scheduled to run on the same day (for example, daily, weekly, and monthly backups are all scheduled to run this Sunday), the Block Volume service will run the backup that has the longest schedule period.

Caution:

All policy-based (scheduled) backups expire. A manual backup expires if a scheduled backup of the same volume is created after the manual backup was created. To keep a volume backup indefinitely, cancel all future scheduled backups and create a manual backup as described in Backing Up Block Volumes.

Creating a Backup Policy

You can use an Oracle defined backup policy, or you can follow the procedures described in this section to create your own backup policy.

For details about Oracle defined backup policies, see Viewing Backup Policies or see "Volume Backups and Clones" in the Block Volume Storage Overview chapter in the Oracle Private Cloud Appliance Concepts Guide.

Using the Compute Web UI

When you create a backup policy by using the Compute Web UI, creating the backup policy schedule is a separate step. A policy cannot be assigned to a resource until the policy schedule is defined.

  1. In the navigation menu, under Block Storage, click Backup Policies.

  2. Click Create Backup Policy.

  3. Enter the following information:

    • Name: Enter a descriptive name for the policy.

    • Create in Compartment: Select the compartment for the policy.

    • Tagging:(Optional) Add defined or free-form tags for this backup policy as described in Adding Tags at Resource Creation. Tags can also be applied later.

  4. Click Create Backup Policy.

    A policy cannot be assigned to a resource until at least one schedule is defined.

  5. Click the name of the new backup policy to go to the details page for the policy.

  6. On the policy details page, scroll to the Resources section and click the Add Schedule button.

  7. In the Add Schedule dialog box, enter the following schedule parameters:

    • Schedule Type: Select Daily, Weekly, or Monthly, and then specify the time for the backup to run and the length of time to retain the backup.

      • Hourly: Select the Retention Time In Hours (1 - 24).

      • Daily: Select the Hour of the Day (0 - 23) and the Retention Time In Days (1 - 365).

      • Weekly: Select the Day of the Week and the Hour of the Day, and select the Retention Time In Weeks (1 - 52).

      • Monthly: Select the Day of the Month (1 - 31) and the Hour of the Day, and select the Retention Time In Months (1 - 144).

    • Time Zone: Select either UTC or your Regional Time.

  8. Click the Add Schedule button in the dialog.

    The policy can now be assigned to one or more resources. See Assigning a Backup Policy to a Volume or Volume Group.

    A policy can have more than one schedule. To add another schedule to this policy, click the Add Schedule button above the list of schedules again. See the schedule notes in Managing Backup Policies.

Using the OCI CLI

  1. Get the OCID of the compartment where the policy will reside (oci iam compartment list).

  2. Construct an argument for the --schedules option.

    A policy cannot be assigned to any resource until you add at least one schedule.

    The following command shows the names of the schedule properties and the required format of the --schedules argument:

    oci bv volume-backup-policy create --generate-param-json-input schedules

    The following example file, named backup_schedules.json, defines two backup schedules for a policy: a daily backup and a monthly backup.

    [
      {
        "hourOfDay": 20,
        "offsetType": "STRUCTURED",
        "period": "ONE_DAY",
        "retentionSeconds": 172800,
        "timeZone": "REGIONAL_DATA_CENTER_TIME"
      },
      {
        "dayOfMonth": 1,
        "hourOfDay": 20,
        "offsetType": "STRUCTURED",
        "period": "ONE_MONTH",
        "retentionSeconds": 5356800,
        "timeZone": "REGIONAL_DATA_CENTER_TIME"
      }
    ]

    The schedule properties can have the following values:

    • backupType - Use FULL.

    • dayOfMonth - 1-31.

    • dayOfWeek - English day name, all uppercase.

    • hourOfDay - 0-23.

    • month - Do not use.

    • offsetSeconds - Minimum 0. Maximum must be specified in multiples of 60 seconds:

      • 3540 (59 minutes) for a ONE_HOUR period schedule

      • 86340 (23 hours, 59 minutes) for a ONE_DAY period schedule

      • 604740 (6 days, 23 hours, 59 minutes) for a ONE_WEEK period schedule

      • 194340 (30 days, 23 hours, 59 minutes) for a ONE_MONTH period schedule

      The value of offsetSeconds is the number of seconds that the volume backup start time should be shifted from the default interval boundaries specified by the period. The volume backup start time is the frequency start time plus the offset.

    • offsetType - STRUCTURED, NUMERIC_SECONDS.

      If the value is STRUCTURED, then hourOfDay, dayOfWeek, and dayOfMonth are used when applicable for the period, and offsetSeconds is ignored.

      If the value is NUMERIC_SECONDS, then offsetSeconds is used and hourOfDay, dayOfWeek, and dayOfMonth are ignored.

    • period - The volume backup frequency: ONE_HOUR, ONE_DAY, ONE_WEEK, ONE_MONTH.

    • retentionSeconds - Minimum 3600 (one hour). Maximum:

      • 86400 (one day) for a ONE_HOUR period schedule

      • 32140800 (one year) for ONE_DAY and ONE_WEEK period schedules

      • 385689600 (12 years) for a ONE_MONTH period schedule

    • timeZone - UTC or REGIONAL_DATA_CENTER_TIME. The default is UTC.

    See also the schedule notes in Managing Backup Policies.

  3. Run the create backup policy command.

    Syntax:

    oci bv volume-backup-policy create --compartment-id <compartment_OCID> \
    
    --schedules JSON_backup_schedules

    Example:

    $ oci bv volume-backup-policy create --compartment-id ocid1.compartment.unique_ID \
    --display-name daily-and-monthly  \
    --schedules file:///backup_schedules.json
    {
      "data": {
        "compartment-id": "ocid1.compartment.unique_ID",
        "defined-tags": {},
        "destination-region": null,
        "display-name": "daily-and-monthly",
        "freeform-tags": {},
        "id": "ocid1.volumebackuppolicy.unique_ID",
        "schedules": [
          {
            "backup-type": null,
            "day-of-month": null,
            "day-of-week": null,
            "hour-of-day": 20,
            "month": null,
            "offset-seconds": null,
            "offset-type": "STRUCTURED",
            "period": "ONE_DAY",
            "retention-seconds": 172800,
            "time-zone": "REGIONAL_DATA_CENTER_TIME"
          },
          {
            "backup-type": null,
            "day-of-month": 1,
            "day-of-week": null,
            "hour-of-day": 20,
            "month": null,
            "offset-seconds": null,
            "offset-type": "STRUCTURED",
            "period": "ONE_MONTH",
            "retention-seconds": 5356800,
            "time-zone": "REGIONAL_DATA_CENTER_TIME"
          }
        ],
        "time-created": "2023-06-08T19:04:21.805470+00:00"
      },
      "etag": "9dbe57ca-9a04-4dc0-9261-90172c1b757d",
      "opc-work-request-id": "ocid1.workrequest.unique_ID"
    }
  4. Assign the policy to a volume.

    See Assigning a Backup Policy to a Volume or Volume Group.

Assigning a Backup Policy to a Volume or Volume Group

You can assign a backup policy to a volume or volume group at resource creation or later:

  • During volume or volume group creation. Select from the Backup Policy list in the Compute Web UI or specify the --backup-policy-id option in the OCI CLI.

  • After the volume or volume group is created. Follow the procedures described in this section to add a backup policy if no backup policy is assigned, or to change the backup policy that is assigned to a volume or volume group.

A volume or volume group can have only one backup policy assigned. If a backup policy is already assigned to this volume or volume group when you assign a new policy, the existing assignment is replaced with the new assignment.

A volume group cannot be assigned a backup policy if any of the volumes in the group already is assigned a backup policy. To remove a backup policy assignment from a volume, see Removing a Backup Policy Assignment.

Note:

Oracle defined backup policies cannot be used for volume group backups. Only user defined backup policies can be assigned to a volume group.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Block Volumes, Boot Volumes, or Volume Groups.

  2. Select the appropriate compartment.

  3. For the volume or volume group to which you want to assign a backup policy, click the Actions menu and then click Assign Backup Policy.

  4. In the Assign Backup Policy dialog, select a backup policy from the drop-down list.

    You cannot assign an Oracle defined policy to a volume group.

  5. Click the Assign Backup Policy button in the dialog.

Using the OCI CLI

  1. Gather the information that you need to run the command:

    • Boot volume, block volume, or volume group OCID. For example: oci bv volume list )

    • Backup policy OCID (oci bv volume-backup-policy list)

  2. Run the command to assign the backup policy to the volume or volume group.

    Syntax:

    oci bv volume-backup-policy-assignment create \
    --asset-id volume_OCID --policy-id backup_policy_OCID

    Example:

    This example assigns a backup policy to block volume. Use this same command with a boot volume or volume group asset. Do not try to assign an Oracle defined policy to a volume group.

    $ oci bv volume-backup-policy-assignment create \
    --asset-id ocid1.volume.unique_ID \
    --policy-id ocid1.volumebackuppolicy.unique_ID
    {
      "data": {
        "asset-id": "ocid1.volume.unique_ID",
        "id": "ocid1.backuppolicyassignment.unique_ID",
        "policy-id": "ocid1.volumebackuppolicy.unique_ID",
        "time-created": "2023-05-26T23:31:53+00:00"
      },
      "etag": "57ddd89d-14bc-4ecf-b164-8a6cc9dc9014",
      "opc-work-request-id": "ocid1.workrequest.unique_ID
    }

Removing a Backup Policy Assignment

Use this procedure to remove a backup policy assignment from a volume or volume group.

A volume group cannot be assigned a backup policy if any of the volumes in the group already is assigned a backup policy.

Using the OCI CLI

  1. Use the appropriate list command to get the OCID of the volume or volume group from which you want to remove the backup policy assignment. For example: oci bv volume list.

  2. Use the volume or volume group OCID from the preceding step as the argument of the --asset-id option in the following command to get the backup policy assignment OCID.

    $ oci bv volume-backup-policy-assignment get-volume-backup-policy-asset-assignment \
    --asset-id ocid1.volume.unique_ID
    {
      "data": [
        {
          "asset-id": "ocid1.volume.unique_ID",
          "id": "ocid1.backuppolicyassignment.unique_ID",
          "policy-id": "ocid1.volumebackuppolicy.unique_ID",
          "time-created": "2023-06-07T02:03:53.466062+00:00"
        }
      ]
    }
  3. Use the backup policy assignment OCID from the preceding step to delete this assignment so that this resource has no backup policy assigned.

    $ oci bv volume-backup-policy-assignment delete \
    --policy-assignment-id ocid1.backuppolicyassignment.AK00661530.scasg01.unique_ID \
    --force
    {
      "etag": "7a0ca7dd-50f7-4d60-9689-02e442ac4348",
      "opc-work-request-id": "ocid1.workrequest.unique_ID"
    }

    The following command shows that this asset has no backup policy assigned.

    $ oci bv volume-backup-policy-assignment get-volume-backup-policy-asset-assignment \
    --asset-id ocid1.volume.unique_ID
    $ 

Viewing Backup Policies

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Backup Policies.

    At a minimum, the Oracle defined policies are listed. If the compartment has any user defined policies, then both Oracle defined and user defined policies are listed.

  2. To view a particular user defined policy, you might need to select a different compartment from the drop-down list above the policies list.

  3. To see details about a policy, click the policy name. Scroll to the Resources section to see the schedules.

Using the OCI CLI

  1. To list user defined backup policies, get the OCID of the compartment where the policies reside (oci iam compartment list)

  2. Run the list backup policies command.

    Syntax:

    If no compartment OCID is provided, then only the Oracle defined policies are listed.

    oci bv volume-backup-policy list

    To list user defined policies, provide the compartment OCID of the user defined policies.

    oci bv volume-backup-policy list --compartment-id compartment_OCID

    Example:

    $ oci bv volume-backup-policy list --compartment-id ocid1.compartment.oc1.unique_ID
    {
      "data": [
        {
          "compartment-id": "ocid1.compartment.oc1.unique_ID",
          "defined-tags": {},
          "destination-region": null,
          "display-name": "daily-backup",
          "freeform-tags": {},
          "id": "ocid1.volumebackuppolicy.unique_ID",
          "schedules": [
            {
              "backup-type": null,
              "day-of-month": null,
              "day-of-week": null,
              "hour-of-day": 20,
              "month": null,
              "offset-seconds": null,
              "offset-type": "STRUCTURED",
              "period": "ONE_DAY",
              "retention-seconds": 172800,
              "time-zone": "REGIONAL_DATA_CENTER_TIME"
            }
          ],
          "time-created": "2023-06-08T19:04:21.805470+00:00"
        }
        {
          "compartment-id": "ocid1.compartment.oc1.unique_ID",
          "defined-tags": {},
          "destination-region": null,
          "display-name": "monthly-backup",
          "freeform-tags": {},
          "id": "ocid1.volumebackuppolicy.unique_ID",
          "schedules": [
            {
              "backup-type": null,
              "day-of-month": 1,
              "day-of-week": null,
              "hour-of-day": 20,
              "month": null,
              "offset-seconds": null,
              "offset-type": "STRUCTURED",
              "period": "ONE_MONTH",
              "retention-seconds": 5443200,
              "time-zone": "REGIONAL_DATA_CENTER_TIME"
            }
          ],
          "time-created": "2023-05-31T22:35:13.267843+00:00
        }
      ],
    }

    To list a specific backup policy, use the get command with the OCID of the backup policy:

    $ oci bv volume-backup-policy get \
    --policy-id ocid1.volumebackuppolicy.unique_ID

    If the compartment-id property value is null, then this is an Oracle defined policy.

Editing a Backup Policy Schedule

You cannot edit an Oracle defined backup policy. You can only edit user defined backup policies.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Backup Policies.

  2. Select the appropriate compartment.

  3. Click the name of the backup policy that has the schedule you want to edit.

  4. On the backup policy details page, scroll to the Resources section.

  5. For the schedule that you want to edit in the Schedules list, click the Actions menu and then click Edit.

  6. Make your changes. See Creating a Backup Policy for details.

  7. Click Update Schedule.

Using the OCI CLI

  1. Get the backup policy OCID (oci bv volume-backup-policy list)

  2. Construct an argument for the --schedules option.

    See Creating a Backup Policy for details.

    The content that you provide in the --schedules argument replaces all current schedule information. Specify all schedule properties, not just the ones you want to change.

  3. Run the edit backup policy command.

    Syntax:

    oci bv volume-backup-policy update --policy-id backup_policy_OCID \
    --schedules JSON_backup_schedule_information

    Example:

    For complete output, see Creating a Backup Policy.

    $ oci bv volume-backup-policy update \
    --policy-id ocid1.volumebackuppolicy.unique_ID \
    --schedules file:///new_backup_schedule.json
    WARNING: Updates to schedules and defined-tags and freeform-tags will replace any existing values. 
    Are you sure you want to continue? [y/N]: y

Deleting a Backup Policy Schedule

You cannot change an Oracle defined backup policy. You can only change or delete the schedules of user defined backup policies.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Backup Policies.

  2. Select the appropriate compartment.

  3. Click the name of the backup policy that has the schedule you want to delete.

  4. On the backup policy details page, scroll to the Resources section.

  5. For the schedule that you want to delete in the Schedules list, click the Actions menu and then click Delete.

  6. Confirm the deletion.

Using the OCI CLI

  1. Get the backup policy OCID (oci bv volume-backup-policy list)

  2. Run the delete backup policy command.

    $ oci bv volume-backup-policy delete \
    --policy-id ocid1.volumebackuppolicy.unique_ID --force

Deleting a Backup Policy

You cannot delete an Oracle defined backup policy. You can only delete user defined backup policies.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Backup Policies.

  2. Select the appropriate compartment.

  3. For the policy you want to delete, click the Actions menu and then click Delete.

  4. Confirm the deletion.

Using the OCI CLI

  1. Get the OCID of the backup policy that you want to delete (oci bv volume-backup-policy list)

  2. Run the delete backup policy command.

    $ oci bv volume-backup-policy delete \
    --policy-id ocid1.volumeBackupPolicy.unique_ID --force
    {
      "etag": "63a6b74f-e86e-423c-9948-123456789012"
    }