Archive data from a source database to an AnalyticDB for PostgreSQL instance through a DMS ticket-based workflow that extracts, loads, and optionally cleans up source tables.
Archiving data to an AnalyticDB for PostgreSQL instance is scheduled for deprecation. The decommissioning date has been postponed to March 19, 2026. For more information, see [Announcement] Discontinuation of the data archiving feature in DMS. Consider using an alternative archiving destination such as OSS, RDS MySQL, or PolarDB MySQL.
Prerequisites
Make sure that you have:
A source database of one of the following types:
MySQL: ApsaraDB RDS for MySQL, PolarDB for MySQL, or AnalyticDB for MySQL V3.0 (scheduled for deprecation)
PostgreSQL: ApsaraDB RDS for PostgreSQL (scheduled for deprecation) or PolarDB for PostgreSQL (scheduled for deprecation)
PolarDB-X 2.0 (scheduled for deprecation)
An AnalyticDB for PostgreSQL instance. For more information, see Create an AnalyticDB for PostgreSQL instance that has vector search engine optimization enabled and Create an AnalyticDB for PostgreSQL instance in Serverless mode
If the source database is MySQL, the database account must have the REPLICATION CLIENT permission.
Create a data archiving ticket
Step 1: Open the data archiving page
Log on to the DMS console V5.0.
In the top navigation bar, choose Solution > Data Archiving.
If you use the DMS console in simple mode, move the pointer over the
icon in the upper-left corner of the DMS console and choose All Features > Solution > Data Archiving.
In the upper-right corner of the Data Archiving Tickets page, click Data Archiving.
Step 2: Configure the archiving ticket
On the Ticket Application page, configure the following parameters.
Parameter | Required | Description |
Task Name | Yes | A descriptive name for the data archiving task. |
Archiving Destination | Yes | Select AnalyticDB PostgreSQL. |
AnalyticDB Instance | Yes | The destination AnalyticDB for PostgreSQL instance. If you select a cost optimization solution and the AnalyticDB for PostgreSQL instance is in Serverless mode with pay-as-you-go billing, the instance auto-starts when archiving begins and auto-pauses after archiving completes. For more information, see Cost optimization (Serverless mode). |
Source Database | Yes | The source database from which to archive data. |
Archiving Configuration | Yes | One or more tables and optional filter conditions for the data to archive. To use time-based filters such as "data older than six months", set time variables in the Variable Configuration section first. |
Archive Table Mapping | No | Table settings in the destination database. Click Edit in the Actions column to specify the name, columns, shard keys, and partition keys of the archive table. |
Variable Configuration | No | Time variables for data archiving. For more information, see the Configure time variables section of the "Variables" topic. |
Post-behavior | No | Whether to delete archived data from the source tables. See Post-behavior options. |
Operation Mode | Yes | Single execution: DMS runs the task once after the ticket is approved. Cyclic scheduling: DMS runs the task on a recurring schedule. For more information, see the Periodic scheduling section of the "Archive data to a Lindorm instance" topic. |
Cost optimization (Serverless mode)
If you select a cost optimization solution and the AnalyticDB for PostgreSQL instance is in Serverless mode with pay-as-you-go billing:
The instance auto-starts when the data archiving task starts.
The instance auto-pauses after the data archiving task completes.
During archiving, you are charged computing and storage fees. For more information, see the Billing rules section of the "Manually pause and resume an instance" topic.
After archiving, while the instance is paused, you are charged only storage fees.
Post-behavior options
Clean up the archived data of the original table (delete-No Lock): DMS automatically deletes the archived data from the source tables by using the
DELETEstatement. Temporary backup tables are created in the source database to store the archived data. Make sure the source database has enough storage space. After verifying that the archived data is correct, create a Normal Data Modify ticket to clear the temporary backup tables.If you do not select the cleanup option, the archived data remains in the source tables. To delete the data manually:
Create a regular data change ticket to delete the archived data. For more information, see Normal Data Modify.
Create a lock-free change ticket to optimize storage usage. For more information, see Perform lock-free DDL operations.
Step 3: Submit and run the task
Click Submit.
After the ticket is approved, DMS automatically runs the data archiving task.
Wait until the data archiving task completes.
If the task fails, click Details in the Execute step to view the task logs and identify the cause. For network or database connection failures, click Retry Breakpoint to restart the task from where it stopped.
Query archived data
Method 1: Use the DMS SQL Console
On the Ticket Details page, in the Basic Information section, click View next to Target Database to go to the SQL Console tab.
On the left-side Table tab, find the archive table, double-click the table name, and then click Execute to view the archived data.
DMS automatically creates a database and tables in the destination instance using the names of the source database and tables. The destination database name matches the source database name.
DMS adds four metadata columns to each archive table. These columns do not affect the original archived data:
Column | Description |
Archiving information | The ticket number and the time when data was archived |
Database name | The name of the source database |
Table name | The name of the source table |
Instance ID | The ID of the instance as registered in DMS |
Method 2: Use AnalyticDB for PostgreSQL directly
For more information, see Query data.
Important considerations
For cost savings, use an AnalyticDB for PostgreSQL instance in Serverless mode. When you create the data archiving ticket, select a cost optimization solution. The Serverless instance auto-starts when archiving begins and auto-pauses after archiving completes, so you pay only storage fees while the instance is idle.
If you select Clean up the archived data of the original table (delete-No Lock) as the post-behavior, make sure the source database has enough storage space. Temporary backup tables are created during cleanup and may cause instance unavailability if storage runs out.
DMS runs periodic archiving tasks only when both the source and destination databases are managed in Security Collaboration or Stable Change mode. Single-execution tasks work in any control mode.
You can archive data to an AnalyticDB for PostgreSQL instance in elastic storage mode or Serverless mode.
For periodic tasks with databases in Stable Change mode, enable security hosting or change the control mode to Security Collaboration. Otherwise, the task may fail because of instance logon expiration. For more information, see the Enable security hosting section of the "Security hosting" topic and Change the control mode of an instance.