This topic describes how to migrate full data from an Amazon Aurora PostgreSQL instance to an ApsaraDB RDS for PostgreSQL instance by using Data Transmission Service (DTS).
Prerequisites
- An Amazon Aurora PostgreSQL instance is created and the database version is 9.4, 9.5, 9.6, or 10.0.
- The Public accessibility option of the Amazon Aurora PostgreSQL instance is set to Yes. This ensures that DTS can access the Amazon Aurora PostgreSQL instance over the Internet.
- An ApsaraDB RDS for PostgreSQL instance is created. For more information, see Create an ApsaraDB RDS for PostgreSQL instance.
Note The database engine version of the ApsaraDB RDS for PostgreSQL instance is 9.4, 10 or 14.
- The available storage space of the ApsaraDB RDS for PostgreSQL instance is larger than the total size of the data in the Amazon Aurora PostgreSQL instance.
Precautions
- DTS uses read and write resources of the source and destination databases during full data migration. This may increase the loads of the database servers. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. For example, you can migrate data when the CPU utilization of the source and destination databases is less than 30%.
- You cannot use DTS to migrate incremental data from an Amazon Aurora PostgreSQL instance to an ApsaraDB RDS for PostgreSQL instance. Before you start the data migration task, you must stop the services that run on the Amazon Aurora PostgreSQL instance. To ensure data consistency, we recommend that you do not write data to the Amazon Aurora PostgreSQL instance during data migration.
- Each data migration task can migrate data from only a single database. To migrate data from multiple databases, you must create a data migration task for each database.
- Functions that are written in the C programming language cannot be migrated.
- The tables to be migrated in the source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
- If a data migration task fails, DTS automatically resumes the task. Therefore, before you switch your workloads to the destination instance, stop or release the data migration task. Otherwise, the data in the source instance overwrites the data in the destination instance after the task is resumed.
Billing
Migration type | Task configuration fee | Internet traffic fee |
---|---|---|
Schema migration and full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Pricing. |
Migration types
- Schema migration
DTS migrates the schemas of required objects to the ApsaraDB RDS for PostgreSQL instance. DTS supports the following types of objects for schema migration: table, trigger, view, sequence, function, user-defined type, rule, domain, operation, and aggregate.
- Full data migration
DTS migrates the historical data of required objects from the Amazon RDS for PostgreSQL instance to the ApsaraDB RDS for PostgreSQL instance.
Permissions required for database accounts
Database | Schema migration | Full data migration |
---|---|---|
Amazon Aurora PostgreSQL | The USAGE permission on pg_catalog | The SELECT permission on the objects to be migrated |
ApsaraDB RDS for PostgreSQL | The CREATE and USAGE permissions on the objects to be migrated | The permissions of the schema owner |
Process of full data migration
To prevent data migration failures caused by dependencies between objects, DTS migrates the schemas and data of the source PostgreSQL database in the following order:
- Migrate the schemas of tables, views, sequences, functions, user-defined types, rules, domains, operations, and aggregates.
- Perform full data migration.
- Migrate the schemas of triggers and foreign keys.
Preparation 1: Edit the inbound rule of the Amazon Aurora PostgreSQL instance
Preparation 2: Create a database and schema in the destination RDS instance
Create a database and schema in the destination RDS 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 Appendix: User and schema management.