Before you use Data Transmission Service (DTS) to migrate data between PostgreSQL databases, you can create a function and a trigger in the source database. The function and trigger obtain the data definition language (DDL) information of the source database. During incremental data migration, DTS migrates DDL operations to the destination database.
Prerequisites
- The source database is a user-created PostgreSQL database V9.4 or later, or an ApsaraDB
RDS for PostgreSQL instance V12, V11, or V10. If the source database is an ApsaraDB
RDS for PostgreSQL instance V10, the storage type of the instance must be Enhanced
SSD or Standard SSD.
Note The source database cannot be an ApsaraDB RDS for PostgreSQL instance V10 or V9.4 whose storage type is Local SSD.
- A data migration task was created after October 1, 2020.
Background information
When you use DTS to migrate data between PostgreSQL databases, DTS synchronizes only data manipulation language (DML) operations during incremental data migration. DML operations include INSERT, DELETE, and UPDATE. DTS does not synchronize DDL operations during incremental data migration.
To synchronize DDL operations, you can create a trigger and a function to obtain the DDL information of the source database. During incremental data migration, DTS migrates DDL operations to the destination database.
Procedure
What to do next
- Migrate incremental data from a user-created PostgreSQL database (versions 9.4 to 10.0) to an ApsaraDB RDS for PostgreSQL instance
- Migrate incremental data from a user-created PostgreSQL database (version 10.1 to 12) to an ApsaraDB RDS for PostgreSQL instance
drop EVENT trigger dts_intercept_ddl;
drop function public.dts_capture_ddl();
drop table public.dts_ddl_command;