DEV Community

Binath Perera
Binath Perera

Posted on

How to recover from a DMS replication error on AWS

Sometimes DMS replication might fail when there is are schema changes that are done through DDL (Data Definition Language) queries in the source database. Following are the steps that can be performed to recover from it (Examples shown are for a Postgres DB instance).

Method 1
Step 1: Remove the DMS task that have failed.
Step 2: Get a dump of failed data into an ec2 instance from the source db.
pg_dump --verbose -F custom -h example.rds.amazonaws.com -U root -d csm -n edf -f edf.dump

Step 3: Restore the dump into the destination db.
nohup pg_restore -h example.rds.amazonaws.com -p 5432 -U root -d csm -j 4 -v lokalise.dump > restore_lokalise.log 2>&1 &

Step 4: Start a new DMS replication task.

Method 2
Step 1: Remove the DMS task that have failed.
Step 2: Create a DMS task with copy and replicate.

Which method should you choose.

If you need the exact meta data from the source data to be reflected at the destination, go with method 1. DMS replication does not create the exact source metadata at the destination.
But if this is not a requirement, go with the second approach which is easier.

Top comments (0)