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 must meet the following requirements:
- If the source database is a self-managed PostgreSQL database, the database version must be V9.4 or later.
- If the source database is an ApsaraDB RDS for PostgreSQL instance, the version of
the ApsaraDB RDS for PostgreSQL instance must be V10 or later.
- ApsaraDB RDS for PostgreSQL V9.4 does not support event triggers.
- The kernel versions of ApsaraDB RDS for PostgreSQL V10, V11, and V12 must be 20201130 or later.
- The kernel versions of ApsaraDB RDS for PostgreSQL V13 must be 20210228 or later.
Note For more information about how to upgrade the kernel version of ApsaraDB RDS for PostgreSQL, see Update the minor engine version of an ApsaraDB RDS for PostgreSQL instance.
- 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 self-managed PostgreSQL database (in PostgreSQL 10.0 or an earlier version) to an ApsaraDB RDS for PostgreSQL instance
- Migrate incremental data from a self-managed PostgreSQL database (version 10.1 to 13) 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;