Skip to content

Latest commit

 

History

History
executable file
·
142 lines (95 loc) · 4.94 KB

File metadata and controls

executable file
·
142 lines (95 loc) · 4.94 KB

Back to main guide|Next


Run a DMS Replication Task for Change Data Capture (CDC)

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

Task 1 - Configure and run a CDC Replication Task

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.

  1. Click on Database migration tasks on the navigation menu, then click on the Create task button.

Create replication task

  1. 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

  1. Expand the Table mappings section, and select Guided UI for the editing mode
  2. 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.

  1. 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.

Create task mappings

  1. After entering the values click on Create task.

  2. Wait till the task status changes to Replication ongoing, this may take a couple of minutes.

    Migration Task Progress


Task 2 - Validate the on going data replication / CDC.

  1. Log in to the SQL Developer connecting to the source Oracle database.
  2. Verify records in existing REGIONS table in HR schema.
SELECT * FROM HR.REGIONS;

Initial verification

  1. 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;

  1. Log in to the SQL Developer connecting to the target Aurora PostgreSQL database.

  2. Verify whether the changes are migrated to REGION table in target Aurora PostgreSQL database.

SELECT * FROM hr.regions;

Final verification

  1. You can verify the number of inserts, deletes, updates, and DDLs by checking the Table statistics of the CDC task (oracle-migration-task-cdc)

Table statistics


Conclusion

This part of the workshop demonstrated a database replication with Data Change Capture in real time.


Back to main guide|Next