Category | Description |
Limits on the source database | The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases. The tables to be migrated must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records. If you select tables as objects that you want to migrate and you need to edit tables, such as renaming tables or columns in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you configure multiple tasks to migrate the tables or configure a task to migrate the entire database. If you need to migrate incremental data, make sure that the following requirements are met: Limits on operations to be performed on the source database: During schema migration and full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails. If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select Schema Migration, Full Data Migration, and Incremental Data Migration as the migration types. If you want to perform a primary/secondary switchover on the source PolarDB for PostgreSQL(Compatible with Oracle) cluster, the Logical Replication Slot Failover feature must be enabled. This prevents logical subscriptions from being interrupted and ensures that your data synchronization task can run as expected. For more information, see Logical replication slot failover.
If one or more long-running transactions exist in the source database and incremental data is migrated in the data migration task, the WAL logs generated before the long-running transactions in the source database are committed may be accumulated. As a result, the disk space of the source database may be insufficient.
|
Other limits | A 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. During incremental data migration, if you select a schema as the object to be migrated, take note of the following limits: If you create a table in the schema or run the RENAME command to rename the table, you must execute the ALTER TABLE schema.table REPLICA IDENTITY FULL; statement before you write data to the table.
Note Replace the schema and table in the preceding sample statement with the actual schema name and table name. To ensure the accuracy of the displayed latency during incremental data migration, DTS creates a table named dts_postgres_heartbeat in the source database. The following figure shows the structure and content of the table. During incremental data migration, DTS creates a replication slot for the source database. The replication slot is prefixed with dts_sync_ . DTS can obtain the incremental logs of the source database within the last 15 minutes by using this replication slot.
Note After the DTS instance is released, the replication slot is automatically deleted. If you change the password of the source database or delete the IP address whitelist of DTS, the replication slot cannot be automatically deleted. In that case, you must manually delete the replication slot from the source database to prevent the replication slot from piling up. If the data migration task is released or fails, DTS automatically clears the replication slot. If a primary/secondary switchover is performed on the source cluster, you must log on to the secondary instance to clear the replication slot.
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. During full data migration, DTS uses the read and write resources of the source and destination databases. This may increase the loads on the database servers. During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the tablespace of the destination database is larger than that of the source database. Make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits. DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination database, you must stop or release the failed tasks. You can also execute the REVOKE statement to revoke the write permissions from the accounts that are used by DTS to access the destination database. Otherwise, the data in the source database overwrites the data in the destination database after the failed task is resumed. DTS does not check the validity of metadata such as sequences. You must manually check the validity of metadata. After your workloads are switched to the destination database, newly written sequences do not increment from the maximum value of the sequences in the source database. Therefore, you must query the maximum value of the sequences in the source database before you switch your workloads to the destination database. Then, you must specify the queried maximum value as the initial value of the sequences in the destination database. You can execute the following statements to query the maximum value of the sequences in the source database: do language plpgsql $$
declare
nsp name;
rel name;
val int8;
begin
for nsp,rel in select nspname,relname from pg_class t2 , pg_namespace t3 where t2.relnamespace=t3.oid and t2.relkind='S'
loop
execute format($_$select last_value from %I.%I$_$, nsp, rel) into val;
raise notice '%',
format($_$select setval('%I.%I'::regclass, %s);$_$, nsp, rel, val+1);
end loop;
end;
$$;
|