Modifies the automatic backup policy of a PolarDB cluster.

Note You can also modify the automatic backup policy of a PolarDB cluster in the console. For more information, see Backup settings.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesModifyBackupPolicy

The operation that you want to perform. Set the value to ModifyBackupPolicy.

DBClusterIdStringYespc-bp13wz9586voc****

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query information about all your PolarDB clusters that are deployed in a specified region. The returned information includes the ID of each cluster.
PreferredBackupTimeStringNo15:00Z-16:00Z

The time period during which automatic backup is performed. The value must be in the hh:mmZ-hh:mmZ format. The time must be in UTC. The start time and end time must be on the hour and with an interval of one hour. Example: 14:00Z-15:00Z.

PreferredBackupPeriodStringNoMonday,Tuesday

The backup cycle. Valid values:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday
Note
  • You must specify at least two values. Separate multiple values with commas (,).
  • If the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature, this parameter is unavailable. For information about regions that support the cross-region backup feature, see Overview.
DataLevel1BackupRetentionPeriodStringNo3

The retention period of level-1 backups. Valid values: 3 to 14. Unit: days.

DataLevel2BackupRetentionPeriodStringNo0

The retention period of level-2 backups. Valid values:

  • 0: The level-2 backup feature is disabled.
  • 30 to 7300: Level-2 backups are retained for 30 to 7,300 days.
  • -1: Level-2 backups are permanently retained.
    Note The default value is 0 when a cluster is created. The default value 0 indicates that the level-2 backup feature is disabled.
BackupRetentionPolicyOnClusterDeletionStringNoNONE

Specifies whether to retain backups when you delete a cluster. Valid values:

  • ALL: permanently retains all backups.
  • LATEST: permanently retains only the last backup.
  • NONE: does not retain backups.
Note The default value is NONE.
BackupFrequencyStringNoNormal

The backup frequency. Default value: Normal. Valid values:

  • Normal: standard backup. The system backs up data once a day.
  • 2/24H: enhanced backup. The system backs up data every 2 hours.
  • 3/24H: enhanced backup. The system backs up data every 3 hours.
  • 4/24H: enhanced backup. The system backs up data every 4 hours.
Note
  • When enhanced backup is enabled, all backups are retained for 24 hours. Backups are automatically deleted when the retention period expires. However, the system permanently retains the first backup that is created after 00:00 every day.
  • When enhanced backup is enable, the PreferredBackupPeriod parameter is automatically set to all days in a week (from Monday to Sunday).
  • If the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature, this parameter is unavailable. For information about regions that support the cross-region backup feature, see Overview.
DataLevel1BackupFrequencyStringNoNormal

The frequency of level-1 backups. Default value: Normal. Valid values:

  • Normal: standard backup. The system backs up data once a day.
  • 2/24H: enhanced backup. The system backs up data every 2 hours.
  • 3/24H: enhanced backup. The system backs up data every 3 hours.
  • 4/24H: enhanced backup. The system backs up data every 4 hours.
Note
  • If your cluster is a PolarDB for Oracle cluster or a PolarDB for PostgreSQL cluster, this parameter is unavailable.
  • This parameter is available only if the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature. For information about regions that support the cross-region backup feature, see Overview.
DataLevel1BackupTimeStringNo15:00Z-16:00Z

The time period during which automatic backup for level-1 backups is performed. The value must be in the hh:mmZ-hh:mmZ format. The time must be in UTC. The start time and end time must be on the hour and with an interval of one hour. Example: 14:00Z-15:00Z.

Note
  • If your cluster is a PolarDB for Oracle cluster or a PolarDB for PostgreSQL cluster, this parameter is unavailable.
  • This parameter is available only if the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature. For information about regions that support the cross-region backup feature, see Overview.
DataLevel1BackupPeriodStringNoMonday,Tuesday

The backup cycle of level-1 backups. Valid values:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday
Note
  • You must specify at least two values. Separate multiple values with commas (,).
  • If your cluster is a PolarDB for Oracle cluster or a PolarDB for PostgreSQL cluster, this parameter is unavailable.
  • This parameter is available only if the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature. For information about regions that support the cross-region backup feature, see Overview.
DataLevel2BackupPeriodStringNoMonday,Tuesday

The backup cycle of level-2 backups. Valid values:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday
Note
  • You must specify at least two values. Separate multiple values with commas (,).
  • If your cluster is a PolarDB for Oracle cluster or a PolarDB for PostgreSQL cluster, this parameter is unavailable.
  • This parameter is available only if the region where your PolarDB for MySQL cluster is deployed supports the cross-region backup feature. For information about regions that support the cross-region backup feature, see Overview.
DataLevel2BackupAnotherRegionRegionStringNocn-hangzhou

The region where the cross-region level-2 backup is stored. For information about regions that support the cross-region backup feature, see Overview.

DataLevel2BackupAnotherRegionRetentionPeriodStringNo30

The retention period of cross-region level-2 backups. Valid values:

  • 0: The cross-region level-2 backup feature is disabled.
  • 30 to 7300: Cross-region level-2 backups are retained for 30 to 7,300 days.
  • -1: Cross-region level-2 backups are permanently retained.
    Note The default value is 0 when a cluster is created. The default value 0 indicates that the cross-region level-2 backup feature is disabled.

Response parameters

ParameterTypeExampleDescription
RequestIdStringC5A5DF0E-5968-4DC1-882E-AC2FE7******

The ID of the request.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/?Action=ModifyBackupPolicy
&DBClusterId=pc-bp13wz9586voc****
&PreferredBackupTime=15:00Z-16:00Z
&PreferredBackupPeriod=Monday,Tuesday
&DataLevel1BackupRetentionPeriod=3
&DataLevel2BackupRetentionPeriod=0
&BackupRetentionPolicyOnClusterDeletion=NONE
&BackupFrequency=Normal
&DataLevel1BackupFrequency=Normal
&DataLevel1BackupTime=15:00Z-16:00Z
&DataLevel1BackupPeriod=Monday,Tuesday
&DataLevel2BackupPeriod=Monday,Tuesday
&DataLevel2BackupAnotherRegionRegion=cn-hangzhou
&DataLevel2BackupAnotherRegionRetentionPeriod=30
&<Common request parameters>

Sample success response

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyBackupPolicyResponse>
<RequestId>C5A5DF0E-5968-4DC1-882E-AC2FE7******</RequestId>
</ModifyBackupPolicyResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "C5A5DF0E-5968-4DC1-882E-AC2FE7******"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidDataLevel1BackupRetentionPeriod.MalformedThe specified parameter DataLevel1BackupRetentionPeriod is not valid.The error message returned because the value of the DataLevel1BackupRetentionPeriod parameter is invalid.
400InvalidDataLevel2BackupRetentionPeriod.MalformedThe specified parameter DataLevel2BackupRetentionPeriod is not valid.The error message returned because the value of the DataLevel2BackupRetentionPeriod parameter is invalid.
400InvalidBackupRetentionPeriod.MalformedThe specified parameter BackupRetentionPeriod is not valid.The error message returned because the value of the BackupRetentionPeriod parameter is invalid.
400InvalidBackupFrequency.MalformedThe specified parameter BackupFrequency is not valid.The error message returned because the value of the BackupFrequency parameter is invalid.
400InvalidPreferredBackupPeriod.MalformedThe specified parameter PreferredBackupPeriod is not valid.The error message returned because the value of the PreferredBackupPeriod parameter is invalid.
400InvalidDataLevel2BackupPeriod.MalformedThe specified parameter DataLevel2BackupPeriod is not valid.The error message returned because the value of the DataLevel2BackupPeriod parameter is invalid.
403IncorrectBackupPolicyCurrent DB type does not support low frequency backupPolicy operation.The error message returned because the database does not support the standard backup operation.
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The error message returned because the specified DBClusterId does not exist in the current record.

For a list of error codes, visit the API Error Center.