Switches the primary zone of a PolarDB cluster.


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 of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyDBClusterPrimaryZone

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

DBClusterId String Yes pc-**************

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.
ZoneId String Yes cn-hangzhou-g

The ID of the destination primary zone.

Note You can call the DescribeRegions operation to query available zones.
VSwitchId String No vsw-**************

The vSwitch ID of in the destination primary zone.

  • This parameter is required if your cluster is a PolarDB for Oracle cluster or a PolarDB for PostgreSQL cluster.
  • If your cluster is a PolarDB for PostgreSQL cluster:
    • this parameter is optional if no vSwitches have been created in the destination zone. The default vSwitch is used.
    • this parameter is required if a vSwitch has been created in the destination zone.
PlannedStartTime String No 2021-01-14T09:00:00Z

The earliest time to switch the primary zone within the scheduled time period. Specify the parameter in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

  • The earliest start time of the task can be a point in time within the next 24 hours. For example, if the current time is 2021-01-14T09:00:00Z, you can specify a point in the time range from 2021-01-14T09:00:00Z to 2021-01-15T09:00:00Z.
  • If this parameter is empty, the primary zone is immediately switched.
PlannedEndTime String No 2021-01-14T09:30:00Z

The latest start time to run the task. Specify the time in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

  • The value of this parameter must be at least 30 minutes later than the value of the PlannedStartTime parameter.
  • If you specify the PlannedStartTime parameter but do not specify a value for the PlannedEndTime parameter, the latest start time of the task is set to a value that is calculated by the value of the PlannedEndTime parameter + 30 minutes by default. For example, if you set the PlannedStartTime parameter to 2021-01-14T09:00:00Z and you do not specify the PlannedEndTime parameter, the latest start time of the task is set to 2021-01-14T09:30:00Z.
FromTimeService Boolean No false

Specify an immediate or scheduled task to switch the primary zone. Default value: false. Valid values:

  • false: scheduled task
  • true: immediate task

Response parameters

Parameter Type Example Description
RequestId String ED12C6FF-3261-4571-AB57-3570F6******

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

  "RequestId" : "ED12C6FF-3261-4571-AB57-3570F6******"

Error codes

HTTP status code Error code Error message Description
400 ScheduleTaskExist The specified cluster already has a scheduled task. The error code returned because a different task is scheduled to run on the specified cluster.
404 InvalidDBCluster.NotFound The 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.