This topic describes how to migrate data from a self-managed PostgreSQL database to an ApsaraDB RDS for PostgreSQL instance by using Data Transmission Service (DTS). DTS supports schema migration, full data migration, and incremental data migration. When you migrate data from a self-managed PostgreSQL database to Alibaba Cloud, you can select all the supported migration types to ensure service continuity.
Prerequisites
- The source self-managed PostgreSQL database and the destination ApsaraDB RDS for PostgreSQL instance are created. For more information about how to create the destination ApsaraDB RDS for PostgreSQL instance, see Create an ApsaraDB RDS for PostgreSQL instance. For more information about the supported database versions, see Overview of data migration scenarios.
Note To ensure compatibility, the database engine version of the destination ApsaraDB RDS for PostgreSQL instance is the same as or later than the database engine version of the source ApsaraDB RDS for PostgreSQL instance.
If the version of the destination database is earlier than the version of the source database, database compatibility issues may occur.
- The available storage space of the destination ApsaraDB RDS for PostgreSQL instance is larger than the total size of the data in the self-managed PostgreSQL database.
Limits
Category | Description |
---|---|
Limits on the source database |
|
Other limits |
|
Migration types
- Schema migration
DTS migrates the schemas of required objects from the source database to the destination database.
- Full data migration
DTS migrates historical data of required objects from the source database to the destination database.
- Incremental data migration
After full data migration is complete, DTS migrates incremental data from the source database to the destination database. Incremental data migration allows you to ensure service continuity when you migrate data between self-managed databases.
SQL operations that can be incrementally migrated
Operation type | SQL statement |
---|---|
DML | INSERT, UPDATE, and DELETE |
Permissions required for database accounts
Database | Schema migration | Full data migration | Incremental data migration |
---|---|---|---|
Self-managed PostgreSQL database | USAGE permission on pg_catalog | SELECT permission on the objects to be migrated | superuser |
ApsaraDB RDS for PostgreSQL instance | CREATE and USAGE permissions on the objects to be migrated | Permissions of the schema owner | Permissions of the schema owner |
For more information about how to create a database account and grant permissions to the account, see the following topics:
- Self-managed PostgreSQL database: CREATE USER and GRANT
- ApsaraDB RDS for PostgreSQL instance: Create an account on an ApsaraDB RDS for PostgreSQL instance
Before you begin
If the version of the self-managed PostgreSQL database is 10.1 to 13, you must perform the following operations before you configure a data migration task.- Download the PostgreSQL source code from the official website, and compile and install
the source code.
- Download the ali_decoding plug-in provided by DTS, and compile and install the plug-in.
- Create a database and schema in the destination ApsaraDB RDS for PostgreSQL instance based on the database and schema information of the objects to be migrated. The schema name of the source and destination databases must be the same. For more information, see Create a database on an ApsaraDB RDS for PostgreSQL instance and Manage accounts by using schemas.