When DTS synchronizes or migrates data incrementally, sequences in the destination database continue generating values independently from the source. This drift can cause primary key conflicts if the destination sequence produces a value that already exists in the migrated data. Use the sequence value adjustment feature to read the current sequence values from the source database, add an offset you specify, and set the result as the starting value of each corresponding sequence in the destination database.
For example, with an offset of 10,000: if a sequence in the source database is currently at 12,345, DTS sets the starting value of the matching sequence in the destination database to 22,345.
Supported database pairs
PostgreSQL in the following table refers to either an ApsaraDB RDS for PostgreSQL instance or a self-managed PostgreSQL database.
| Source database | Destination database | Reference |
|---|---|---|
| PostgreSQL | PostgreSQL, PolarDB (Compatible with Oracle), or PolarDB for PostgreSQL | Synchronize data from a PostgreSQL database / Migrate data from a PostgreSQL database |
| PolarDB for PostgreSQL | PostgreSQL or PolarDB for PostgreSQL | Synchronize data from a PolarDB for PostgreSQL cluster / Migrate data from a PolarDB for PostgreSQL cluster |
| PolarDB (Compatible with Oracle) | PolarDB (Compatible with Oracle) | One-way data synchronization between PolarDB for PostgreSQL (Compatible with Oracle) clusters / Migrate data between PolarDB for PostgreSQL (Compatible with Oracle) clusters |
| Oracle | PolarDB (Compatible with Oracle) | Synchronize data from a self-managed Oracle database to a PolarDB for PostgreSQL (Compatible with Oracle) cluster / Migrate data from a self-managed Oracle database to a PolarDB for PostgreSQL (Compatible with Oracle) cluster |
Prerequisites
Before you begin, make sure that:
The instance involves incremental data synchronization or migration
The instance is in the Incremental Data Migration or Incremental Data Synchronization phase
The Status of the instance is Running or Paused
Limitations
Not supported for two-way synchronization instances.
By default, DTS updates the starting value of a sequence in the destination database based on the current value of a sequence with the same name in the source database. Adjusting individual sequences is not supported.
If incremental data is written to the source database after the starting values of sequences in the destination database are updated, the updated sequence values may not meet your expectations.
Update sequence starting values
Go to the Data Synchronization or Data Migration page.
Use the DTS console
Log on to the DTS console. In the left-side navigation pane, click Data Synchronization or Data Migration. In the top navigation bar, select the region where your DTS instance resides.
Use the DMS console
Log on to the DMS console. In the top navigation bar, choose Data + AI > DTS (DTS) > Data Synchronization or Data + AI > DTS (DTS) > Data Migration. From the drop-down list to the right of Data Synchronization Tasks or Data Migration Tasks, select the region where your DTS instance resides.
Find your DTS instance and click the instance ID.
On the Task Management page, click Incremental Write.Data Management (DMS)
On the Basic Information tab, click Synchronize Sequence.
In the dialog box, set the Sequence Offset value.
Click Synchronize. After the update completes, the Synchronized message appears and the sequence values before and after the update are displayed.
Click Close.