Update sequence values in the destination database
Use Data Transmission Service (DTS) to update sequence values in the destination database of a synchronization or migration instance, preventing primary key conflicts caused by sequence changes.
Background information
A sequence is a database object that generates unique ascending or descending numbers, typically used as primary key values. After data synchronization or migration, sequence changes may cause primary key conflicts in the destination database. The sequence value adjustment feature reads the current sequence value from the source database, adds an offset, and applies the result to the destination database.
For example, if the current value of a sequence in the source database is 12345 and you set the offset to 10000, DTS updates the value of the corresponding sequence in the destination database to 22345.
Supported databases
In the following table, PostgreSQL refers to both ApsaraDB RDS for PostgreSQL instances and self-managed PostgreSQL databases.
|
Source |
Destination |
Documentation |
|
PostgreSQL |
PostgreSQL, PolarDB (Compatible with Oracle), PolarDB for PostgreSQL |
|
|
PolarDB for PostgreSQL |
PostgreSQL, PolarDB for PostgreSQL |
|
|
PolarDB (Compatible with Oracle) |
PolarDB (Compatible with Oracle) |
|
|
Oracle |
PolarDB (Compatible with Oracle) |
Prerequisites
The synchronization or migration instance must meet the following conditions:
-
The instance is a data synchronization or migration instance that includes an incremental task.
-
The instance has entered the Incremental Data Migration or Incremental Data Synchronization phase.
-
The Status of the instance is Running or Paused.
Considerations
-
This feature is not supported for two-way synchronization instances.
-
By default, DTS updates a sequence in the destination database when its name matches a sequence in the source database.
-
If incremental data is written to the source database after you update sequence values, the destination sequence values may become incorrect.
Procedure
-
Navigate to the task list page for the appropriate region using one of the following methods.
DTS console
-
Log on to the Data Transmission Service (DTS) console.
-
In the left-side navigation pane, click Data Synchronization or Data Migration.
-
In the upper-left corner of the page, select the region where the instance is located.
DMS console
NoteThe steps may vary depending on the mode and layout of the Data Management Service (DMS) console. For more information, see Simple mode console and Customize the layout and style of the DMS console.
-
Log on to the Data Management Service (DMS) console.
-
In the top menu bar, choose or .
-
From the drop-down list to the right of Data Synchronization Tasks or Data Migration Tasks, select the region where the instance is located.
-
-
Find the target instance and click the instance ID.
-
Update the sequence values in the destination database.
-
On the Task Management page, click the Incremental Write tab.
-
On the Basic Information tab, click Sync Sequence.
-
In the dialog box that appears, set the Offset.
-
At the bottom of the dialog box, click Synchronize.
-
-
View the result.
When the task is complete, a Synchronized message is displayed, showing the sequence values before and after the update.
-
Click Close.