Use these procedures to undo a data migration from an ApsaraDB RDS for MySQL instance to a PolarDB cluster. Two actions are available depending on your situation:
| Action | When to use | Effect |
|---|---|---|
| Roll back migration | Before migration is complete and you detect data exceptions | Restores the source instance and destination cluster to their pre-migration states. Data syncs from PolarDB back to RDS. |
| Cancel migration | When you want to permanently stop the migration | Breaks the migration link. |
(Optional) Roll back migration
If you detect data exceptions before the migration is complete, roll back the migration to restore the source ApsaraDB RDS for MySQL instance and destination PolarDB cluster to their pre-migration states.
Before migration, the ApsaraDB RDS for MySQL instance is in read-write mode and the PolarDB cluster is in read-only mode. After a rollback, this state is restored, and data syncs from the PolarDB cluster back to the ApsaraDB RDS for MySQL instance.
Log on to the PolarDB console.
Find the destination cluster and click the cluster ID.
On the Basic Information page, in the RDS Migration section, click Roll Back Migration.
In the Switches the business back to the original database dialog box, select a switchback option based on whether your application can tolerate a connection string change, then click OK.

The two options differ in how endpoints are handled during the switchback:
Option Endpoint handling What to do after switchback Switch Back with Endpoints (Connection Changes Not Required) The system swaps the endpoints between the source ApsaraDB RDS for MySQL instance and the destination PolarDB cluster. No application changes needed. Switch Back without Endpoints (Connection Changes Required) Endpoints are not swapped. Update the database endpoint in your application as soon as Source RDS Read/Write Status shows Read/Write.
In both cases, after the switchback the ApsaraDB RDS for MySQL instance is in read-write mode, the PolarDB cluster is in read-only mode, and data syncs from the PolarDB cluster to the ApsaraDB RDS for MySQL instance.
(Optional) Cancel migration
Log on to the PolarDB console.
Find the destination cluster and click the cluster ID.
On the Basic Information page, in the RDS Migration section, click Cancel Migration.

In the Cancel Migration message, click OK.
