All Products
Search
Document Center

Data Management:ModifyBackupPolicy

Last Updated:Oct 12, 2026

Modifies the backup policy of a PolarDB instance.

Operation description

Supported engines

PolarDB for MySQL

Note

This operation is currently available only to specific customers. To request access, join the DBS customer consultation DingTalk group (group ID: 35585947).

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dbs:ModifyBackupPolicy

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionCode

string

No

The region where the backup set is located.

cn-shanghai

PreferredBackupWindowBegin

string

No

The start time of the basic backup window.

17:00Z

InstanceName

string

No

The PolarDB instance ID.

pc-2ze3nrr64c5****

Category

string

No

The backup type. Valid values:

  • Flash: backup within seconds

  • Standard: regular backup

Flash

AdvanceLogPolicies

array<object>

No

The destination region of the backup policy.

object

No

The source region of the backup policy.

LogRetentionType

string

No

The retention period type. Valid values:

  • Never: never expires

  • Delay: expires after a fixed number of days

Never

DestType

string

No

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

FilterType

string

No

The advanced policy filter type. Valid values:

  • Crontab: periodic scheduling

  • Event: event-based scheduling

crontab

ActionType

string

No

The operation type. Valid values: CREATE, UPDATE, and DELETE.

CREATE

SrcRegion

string

No

The source region of the backup policy.

cn-hangzhou

EnableLogBackup

integer

No

Specifies whether log backup is enabled. Valid values:

  • 1: enabled

  • 0: disabled

1

SrcType

string

No

The source type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

db

LogRetentionValue

string

No

The number of days before expiration.

30

PolicyId

string

No

The ID of the advanced policy.

31289676-bb8d-4dee-b83e-******

FilterKey

string

No

The scheduling type. This parameter is valid only when FilterType is set to crontab. Valid values:

  • dayOfWeek: weekly scheduling

  • dayOfMonth: monthly scheduling

  • dayOfYear: yearly scheduling

  • backupInterval: fixed-interval scheduling

dayOfMonth

DestRegion

string

No

The destination region of the backup policy.

cn-hangzhou

FilterValue

string

No

The specific value of the filter.

1

AdvanceDataPolicies

array<object>

No

The details of the data backup policy.

object

No

The policy details.

DestType

string

No

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

FilterType

string

No

The advanced policy filter type. Valid values:

  • crontab: periodic scheduling

  • event: event-based scheduling

crontab

ActionType

string

No

The operation type. Valid values:

  • CREATE: create

  • UPDATE: update

  • DELETE: delete

UPDATE

SrcRegion

string

No

The source region of the backup policy.

cn-shanghai

SrcType

string

No

The source type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

db

OnlyPreserveOneEachDay

boolean

No

Specifies whether to retain only one high-frequency backup set per day for backup sets created more than one day ago.

true

RetentionValue

string

No

The number of days before expiration.

4

PolicyId

string

No

The ID of the advanced policy. You can call the DescribeBackupPolicy operation to query the ID.

6s67c7i3y8f8p72808p******

FilterKey

string

No

The scheduling type. Valid values:

  • dayOfWeek: weekly scheduling

  • dayOfMonth: monthly scheduling

  • dayOfYear: yearly scheduling

  • backupInterval: fixed-interval scheduling

Note

This parameter is returned only when FilterType is set to crontab.

backupInterval

DestRegion

string

No

The destination region of the backup policy.

cn-shanghai

FilterValue

string

No

The backup cycle.

180

RetentionType

string

No

The retention period type of the backup set. Valid values:

  • never: never expires

  • delay: expires after a fixed number of days

delay

StorageClass

string

No

The storage class of the bucket. Valid values:

  • Standard (default): standard storage

  • IA: infrequent access

  • Archive: archive storage

  • ColdArchive: cold archive storage

  • DeepColdArchive: deep cold archive storage

Standard

AdvanceIncPolicies

array<object>

No

The destination region of the backup policy.

object

No

The source region of the backup policy.

DestType

string

No

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

FilterType

string

No

The advanced policy filter type. Valid values:

  • Crontab: periodic scheduling

  • Event: event-based scheduling

crontab

ActionType

string

No

The operation type. Valid values: CREATE, UPDATE, and DELETE.

CREATE

SrcRegion

string

No

The source region of the backup policy.

cn-hangzhou

SrcType

string

No

The source type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

db

OnlyPreserveOneEachDay

boolean

No

Specifies whether to retain only one high-frequency backup set per day for backup sets created more than one day ago.

true

RetentionValue

string

No

The number of days before expiration.

365

PolicyId

string

No

The ID of the advanced policy.

1

FilterKey

string

No

The scheduling type. This parameter is valid only when FilterType is set to crontab. Valid values:

  • dayOfWeek: weekly scheduling

  • dayOfMonth: monthly scheduling

  • dayOfYear: yearly scheduling

  • backupInterval: fixed-interval scheduling

dayOfMonth

DestRegion

string

No

The destination region of the backup policy.

cn-hangzhou

FilterValue

string

No

The specific value of the filter.

1

RetentionType

string

No

The retention period type. Valid values:

  • Never: never expires

  • Delay: expires after a fixed number of days

delay

BackupRetentionPolicyOnClusterDeletion

string

No

The data retention policy for archived backups of deleted instances. Valid values:

  • NONE: Does not retain backups.

  • LATEST: Retains the latest backup.

  • ALL: Retains all backups.

0

BackupMethod

string

No

The backup method. Valid values:

  • logical: Logical backup.

  • physical: Physical backup.

logical

BackupPriority

integer

No

The backup policy for secondary instances. Valid values:

  • 1: Prioritizes secondary instances.

  • 2: Forces backup on the primary instance.

Note

This parameter applies only to ApsaraDB RDS for SQL Server instances. For other database engines, the value 0 is returned.

2

EnableIncBackup

boolean

No

Specifies whether incremental backup is enabled.

true

BackupRetentionPeriod

integer

No

The retention period for basic backups in days. If the advanced backup policy is enabled, this parameter indicates the maximum retention period in the level-1 backup policy.

7

HighFrequencyBakInterval

integer

No

The interval for high-frequency backups in minutes. For example, a value of 120 indicates that a backup is performed every two hours.

120

EnableLogBackup

integer

No

Specifies whether log backup is enabled. Valid values:

  • 1: Enabled.

  • 0: Disabled.

1

LogBackupRetention

integer

No

The retention period for log backups in days.

7

LogBackupLocalRetentionNumber

integer

No

The number of binary log files to retain.

10

LocalLogRetentionSpace

integer

No

The maximum space usage for binary logs.

30

HighSpaceUsageProtection

string

No

Specifies whether to force log cleanup when the instance space usage exceeds 80% or the remaining space is less than 5 GB. Valid values:

  • disable: Does not clean up logs.

  • enable: Cleans up logs.

Valid values:

  • disable :

    Does not clean up logs.

  • enable :

    Cleans up logs.

enable

IncBackupInterval

integer

No

The interval for high-frequency incremental backups in minutes.

120

EnablePitrProtection

boolean

No

Specifies whether point-in-time protection is enabled.

PreferredBackupDate

string

No

The backup epoch for basic backups. The value is a 7-digit string where each digit from left to right corresponds to a day of the week from Monday to Sunday. A value of 1 indicates that a backup is executed on that day, and 0 indicates that no backup is executed.

1111111

LogBackupLocalRetention

integer

No

The retention period for binary logs in seconds.

7

ColdRetention

integer

No

The retention period for cold archives in days.

10

ColdKeepCount

integer

No

The number of cold archives to retain.

1

ColdKeepPolicy

integer

No

The data retention policy for cold archives.

0

Response elements

Element

Type

Description

Example

object

The response parameter details.

RequestId

string

The request ID.

D570F209-A166-50C6-98A3-155A20B218B7

Message

string

The returned message.

instanceName can not be empty.

Data

object

The backup policy details.

PreferredBackupWindowBegin

string

The start time of the basic backup window.

17:00Z

PreferredBackupWindow

string

The basic backup window.

17:00Z-18:00Z

Category

string

Indicates whether backup within seconds is enabled. Valid values:

  • Flash: Backup within seconds is enabled.

  • Standard: Standard backup.

Note

This parameter takes effect only for MySQL.

Standard

AdvanceLogPolicies

array<object>

The policy details.

object

The policy details.

LogRetentionType

string

The log backup retention type. Valid values:

  • Never: Never expires.

  • Delay: Expires by day.

delay

DestType

string

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

FilterType

string

The filter type of the advanced policy. Valid values:

  • crontab: Periodic scheduling.

  • event: Event-based scheduling.

crontab

SrcRegion

string

The source region of the backup policy.

cn-beijing

EnableLogBackup

integer

A reserved parameter. Ignore this parameter.

1

SrcType

string

The source type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

PolicyId

string

The backup policy ID.

dc13b153acc91141789122c23835****

DestRegion

string

The destination region of the backup policy.

cn-shanghai

LogRetentionValue

string

The log backup retention period.

3

FilterKey

string

The scheduling type. This parameter is valid only when FilterType is set to crontab. Valid values:

  • dayOfWeek: weekly scheduling

  • dayOfMonth: monthly scheduling

  • dayOfYear: yearly scheduling

  • backupInterval: fixed-interval scheduling

dayOfMonth

FilterValue

string

The backup cycle.

1

AdvanceDataPolicies

array<object>

The details of the data backup policy.

object

The policy details.

RetentionValue

string

The number of days before expiration.

4

BakType

string

The backup type. Valid values:

  • F: Full backup.

  • L: Log backup.

F

FilterKey

string

The scheduling type. Valid values:

  • dayOfWeek: Weekly scheduling.

  • dayOfMonth: Monthly scheduling.

  • dayOfYear: Yearly scheduling.

  • backupInterval: Fixed-interval scheduling.

Note

This parameter is returned only when FilterType is set to crontab.

backupInterval

FilterValue

string

The backup cycle.

180

DestType

string

The destination type of the backup policy. Valid values:

  • db: Database.

  • level1: Level-1 backup.

  • level2: Level-2 backup.

  • level2Cross: Level-2 cross-region backup.

level1

FilterType

string

The filter type of the advanced policy. Valid values:

  • crontab: Periodic scheduling.

  • event: Event-based scheduling.

crontab

SrcRegion

string

The source region of the backup policy.

cn-shanghai

AutoCreated

boolean

Indicates whether the backup policy is automatically generated by the system. Valid values:

  • true: The policy is generated by the system.

  • false: The policy is customized by the user.

false

SrcType

string

The source type of the backup policy. Valid values:

  • db: Database.

  • level1: Level-1 backup.

  • level2: Level-2 backup.

  • level2Cross: Level-2 cross-region backup.

db

OnlyPreserveOneEachDay

boolean

Indicates whether to retain only one backup per day. Valid values:

  • true: Retains only one backup per day.

  • false: Retains all backups.

true

DumpAction

string

The dump policy details. Valid values:

  • copy: Copy.

  • move: Dump.

copy

PolicyId

string

The advanced policy ID.

dc13b153acc91141789122c23835****

DestRegion

string

The destination region of the backup policy.

cn-shanghai

RetentionType

string

The retention period type of the backup set. Valid values:

  • never: Never expires.

  • delay: Expires after a fixed number of days.

delay

StorageClass

string

The data storage class.

ARCHIVE

AdvanceIncPolicies

array<object>

The retention period type. Valid values:

  • Never: never expires

  • Delay: expires after a fixed number of days

object

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

RetentionValue

string

The number of days before expiration.

365

BakType

string

The backup type. F indicates full backup, and L indicates log backup.

F

FilterKey

string

The scheduling type. This parameter is valid only when FilterType is set to crontab. Valid values:

  • dayOfWeek: weekly scheduling

  • dayOfMonth: monthly scheduling

  • dayOfYear: yearly scheduling

  • backupInterval: fixed-interval scheduling

dayOfMonth

FilterValue

string

The specific value of the filter.

1

DestType

string

The destination type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

level1

FilterType

string

The advanced policy filter type. Valid values:

  • Crontab: periodic scheduling

  • Event: event-based scheduling

Crontab

SrcRegion

string

The source region of the backup policy.

cn-hangzhou

AutoCreated

boolean

Indicates whether the policy is automatically generated by the system.

true

SrcType

string

The source type of the backup policy. Valid values:

  • db: database

  • level1: level-1 backup

  • level2: level-2 backup

  • level2Cross: cross-region level-2 backup

db

OnlyPreserveOneEachDay

boolean

The 24-hour backup data retention policy. Valid values:

  • true: Retains only the first backup set of the day after 24 hours.

  • false: Retains all backup sets.

true

DumpAction

string

The dump action. Valid values:

  • Copy: Copy.

  • Move: Dump.

Copy

PolicyId

string

The ID of the advanced policy.

smp-8sv763r9boydzb***

DestRegion

string

The destination region of the backup policy.

cn-hangzhou

RetentionType

string

The retention period type. Valid values:

  • Never: never expires

  • Delay: expires after a fixed number of days

Delay

BackupRetentionPolicyOnClusterDeletion

string

The data retention policy for archived backups after an instance is deleted. Valid values:

  • NONE: Does not retain backups.

  • LATEST: Retains the latest backup.

  • ALL: Retains all backups.

LATEST

BackupMethod

string

The backup method. Valid values:

  • Physical: Physical backup.

  • Snapshot: Snapshot backup.

Physical

BackupPriority

integer

The backup policy for secondary instances. Valid values:

  • 1: Prioritizes secondary instances.

  • 2: Forces backup on the primary instance.

Note

This parameter applies only to ApsaraDB RDS for SQL Server instances. For other database engines, the value 0 is returned.

1

EnableIncBackup

boolean

Specifies whether incremental backup is enabled.

true

ErrMessage

string

The error message.

The specified parameter %s value is not valid.

Code

string

The status code.

Success

Success

string

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

ErrCode

string

The error code.

Success

Examples

Success response

JSON format

{
  "RequestId": "D570F209-A166-50C6-98A3-155A20B218B7",
  "Message": "instanceName can not be empty.",
  "Data": {
    "PreferredBackupWindowBegin": "17:00Z",
    "PreferredBackupWindow": "17:00Z-18:00Z",
    "Category": "Standard",
    "AdvanceLogPolicies": [
      {
        "LogRetentionType": "delay",
        "DestType": "level1",
        "FilterType": "crontab",
        "SrcRegion": "cn-beijing",
        "EnableLogBackup": 1,
        "SrcType": "level1",
        "PolicyId": "dc13b153acc91141789122c23835****",
        "DestRegion": "cn-shanghai",
        "LogRetentionValue": "3",
        "FilterKey": "dayOfMonth",
        "FilterValue": "1"
      }
    ],
    "AdvanceDataPolicies": [
      {
        "RetentionValue": "4",
        "BakType": "F",
        "FilterKey": "backupInterval",
        "FilterValue": "180",
        "DestType": "level1",
        "FilterType": "crontab",
        "SrcRegion": "cn-shanghai",
        "AutoCreated": false,
        "SrcType": "db",
        "OnlyPreserveOneEachDay": true,
        "DumpAction": "copy",
        "PolicyId": "dc13b153acc91141789122c23835****",
        "DestRegion": "cn-shanghai",
        "RetentionType": "delay",
        "StorageClass": "ARCHIVE"
      }
    ],
    "AdvanceIncPolicies": [
      {
        "RetentionValue": "365",
        "BakType": "F",
        "FilterKey": "dayOfMonth",
        "FilterValue": "1",
        "DestType": "level1",
        "FilterType": "Crontab",
        "SrcRegion": "cn-hangzhou",
        "AutoCreated": true,
        "SrcType": "db",
        "OnlyPreserveOneEachDay": true,
        "DumpAction": "Copy",
        "PolicyId": "smp-8sv763r9boydzb***",
        "DestRegion": "cn-hangzhou",
        "RetentionType": "Delay"
      }
    ],
    "BackupRetentionPolicyOnClusterDeletion": "LATEST",
    "BackupMethod": "Physical",
    "BackupPriority": 1,
    "EnableIncBackup": true
  },
  "ErrMessage": "The specified parameter %s value is not valid.",
  "Code": "Success",
  "Success": "true",
  "ErrCode": "Success"
}

Error codes

HTTP status code

Error code

Error message

Description

403 Request.Forbidden Have no Permissions

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.