You can use AWS Database Migration Service to perform continuous data replication. This helps you migrate your databases to AWS with virtually no downtime. All data changes to the source database that occur during the migration are continuously replicated to the target, allowing the source database to be fully operational during the migration process. After the database migration is complete, the target database will remain synchronized with the source for as long as you choose, allowing you to switchover the database at a convenient time.
To capture change data, the source database must be in ARCHIVELOG mode and supplemental logging must be enabled.
Refer to Using Oracle LogMiner or Oracle Binary Reader for Change Data Capture (CDC) for more details on configuring the source database for CDC.
Note: For this workshop, we have already made the configutation changes to the source Oracle database to support CDC.
In this activity, you perform the following tasks:
- Run a DMS Replication Task for Change Data Capture (CDC)
- Enable CDC on the source database
- Set up and run a Replication Task
- Introduce changes at the source database
- Validate the CDC result at the target database
In this part of the lab you are going to create another Database Migration Task for capturing data changes from the source Oracle database and migrate to target Aurora PostgreSQL.
- Click on Database migration tasks on the navigation menu, then click on the Create task button.
- Create a data migration task with the following values for migrating the
HR
database.
Parameter | Value |
---|---|
Task identifier | oracle-migration-task-cdc |
Replication instance | your replication instance |
Source database endpoint | oracle-source |
Target database endpoint | aurora-postgresql-target |
Migration type | Replicate data changes only |
Start task on create | Checked |
CDC start mode | Don’t use custom CDC start mode |
CDC stop mode | Don’t use custom CDC stop mode |
Create recovery table on target DB | Unchecked |
Target table preparation mode | Do nothing |
Include LOB columns in replication | Limited LOB mode |
Max LOB size (KB) | 32 |
Enable validation | Unchecked |
Enable CloudWatch logs | Checked |
Enabling the logging would help debugging issues that DMS encounters during data migration
- Expand the Table mappings section, and select Guided UI for the editing mode
- The Table mappings are as below which are same as the mappings of the previous full-load replication task. Click on Add new selection rule button and enter the following values.
Parameter | Value |
---|---|
Schema name | HR |
Table name | % |
Action | Include |
Hint:click “Enter a schema” from drop down to enter the schema name.
- Next, expand the Transformation rules section, and click on Add new transformation rule. Then, create the following rules:
Parameter | Value |
---|---|
Target | Schema |
Schema name | HR |
Action | Make lowercase |
Parameter | Value |
---|---|
Target | Table |
Schema Name | HR |
Table Name | % |
Action | Make lowercase |
Parameter | Value |
---|---|
Target | Column |
Schema Name | HR |
Table Name | % |
Column Name | % |
Action | Make lowercase |
Verify that your DMS task configuration is same as in the following screen-shot.
-
After entering the values click on Create task.
-
Wait till the task status changes to Replication ongoing, this may take a couple of minutes.
- Log in to the SQL Developer connecting to the source Oracle database.
- Verify records in existing
REGIONS
table inHR
schema.
SELECT * FROM HR.REGIONS;
- Add two new rows to the
REGIONS
table
INSERT INTO HR.REGIONS VALUES (5,'APAC');
INSERT INTO HR.REGIONS VALUES (6,'LATIN AMERICA');
COMMIT WORK;
-
Log in to the SQL Developer connecting to the target Aurora PostgreSQL database.
-
Verify whether the changes are migrated to
REGION
table in target Aurora PostgreSQL database.
SELECT * FROM hr.regions;
- You can verify the number of inserts, deletes, updates, and DDLs by checking the Table statistics of the CDC task (oracle-migration-task-cdc)
This part of the workshop demonstrated a database replication with Data Change Capture in real time.