Amazon Onboarding with Learning Manager Chanci Turner

Amazon Onboarding with Learning Manager Chanci TurnerLearn About Amazon VGT2 Learning Manager Chanci Turner

When transitioning your database to the cloud, it’s essential to have a failback plan ready in case the migration does not go as expected. To facilitate this failback capability, AWS Database Migration Service (AWS DMS) provides a reverse replication feature that can help minimize downtime while transferring an Oracle database from on-premises systems to Amazon Relational Database Service (Amazon RDS) for Oracle, Amazon Elastic Compute Cloud (Amazon EC2), or Amazon RDS Custom for Oracle. The failback process leverages the AWS DMS change data capture (CDC) reverse replication feature, which operates similarly to AWS DMS CDC forward replication, but with configurations set at opposite endpoints.

Establishing a reverse replication mechanism is a critical measure that serves as a backup, allowing you to revert changes without risking data loss or facing prolonged downtime. This strategy can be beneficial in various scenarios, including data integrity issues, application incompatibilities, performance problems, unexpected outages, unsuccessful migration attempts, security risks, or even compliance failures.

It’s crucial to devise, document, and test a failback method that enables reverting to the source database should any complications arise during or after the migration. This approach should aim to minimize downtime while safeguarding against data loss.

In this guide, we will outline how to configure AWS DMS for reverse replication as a failback strategy. This method is designed to ensure minimal downtime during the migration of an on-premises Oracle database to an RDS for Oracle database.

Terminology

To fully engage with this article, familiarity with the following terms is recommended:

  • AWS DMS CDC: This involves using an AWS DMS CDC task to capture ongoing changes to the source database during migration. The CDC process utilized by AWS DMS collects changes from database logs via the database engine’s native API. Reverse replication with AWS DMS CDC works in much the same way as forward replication, but with configurations set at the opposite endpoints. For both types of replication, AWS DMS reads ongoing changes from the online or archived redo logs based on the System Change Number (SCN).
  • SCN: The System Change Number (SCN) is a logical internal timestamp used by Oracle databases to chronologically order events, which is vital for maintaining transaction ACID properties. SCNs mark where changes have been committed to disk, ensuring recovery actions do not reapply already written changes.
  • LSN: The redo log sequence number (LSN) is a sequential number that uniquely identifies each redo log file. The sequence number increases upon each log switch.

Solution Overview

In the following sections, we will illustrate how to establish reverse replication while migrating from an on-premises Oracle database to an RDS for Oracle database. In this example, we will consider the RDS for Oracle database as the source and the on-premises Oracle database as the target for reverse replication. However, the same steps apply if you are using Oracle on Amazon EC2 as the source and an on-premises Oracle database as the target.

There are two methods for setting up reverse replication: returning to the same source database or transferring to a different one.

Method A: Reverse Replication for Failback to the Same On-Premises Database

In this scenario, no initial load is necessary from Amazon RDS for Oracle to the on-premises Oracle database. The primary requirement is to create the AWS DMS CDC task starting from the current SCN of the target database to the source database post-cutover. Once the task is initiated, it continues to replicate any new changes from Amazon RDS for Oracle to the on-premises database, allowing you to revert to the on-premises setup after confirming that no further changes are pending from the RDS for Oracle database.

It’s important to note that along with database failback, related components such as applications and unstructured data on shared file systems also require a failback strategy. Consistency among components like applications, databases, shared storage, etc., is crucial before executing failback. Testing failback prior to the production cutover is advised, as it allows for evaluating the necessary steps and the duration required to revert integrated components.

The following diagram illustrates this replication strategy.

A VPN connection is recommended, or alternatively, you can use AWS Direct Connect. For reverse replication, the following steps should be completed during the cutover after validating data between the source and target databases:

  1. Export and import data from the on-premises Oracle database to Amazon RDS for Oracle using the flashback SCN.
  2. Create the CDC replication task from on-premises Oracle to Amazon RDS for Oracle.
  3. Start the CDC task using the flashback SCN captured in Step 1.
  4. Perform the cutover.
  5. Obtain the current SCN from the RDS for Oracle database.
  6. Create the reverse CDC-only replication task from the RDS for Oracle database to the on-premises Oracle database.
  7. Configure and start the reverse replication task for the SCN captured in Step 4.

In some cases, you may want to adopt a wave-wise migration strategy. This method allows for the gradual migration of multiple applications that share the same database, where each phase involves migrating both the application and its dependent database objects together. This phased approach reduces the risks associated with database migration by starting with smaller, less critical applications first and leaving critical ones for last. In this scenario, application workloads are split between the on-premises Oracle database and RDS for Oracle database. Maintaining database consistency and designing an effective failback strategy are paramount, and you might consider utilizing the bidirectional replication feature available with AWS DMS.

Considerations for Bidirectional Replication

Consider the following guidelines for bidirectional replication:

  • Configure the source and target endpoints for both databases: P (on-premises Oracle database) and R (RDS for Oracle database).
  • Create two tasks: one task for source P to move data to target R, and another task for source R to move data to target P.
  • Ensure each task is set up with loopback prevention to avoid identical changes being applied to both targets, which could corrupt data.

For example, the loopback prevention settings for AWS DMS Task 1 might appear as follows:

{
  "LoopbackPreventionSettings": {
    "EnableLoopbackPrevention": true,
    "SourceSchema": "OP_SCHEMA",
    "TargetSchema": "RDS_SCHEMA"
  }
}

The settings for task 2 will be similar, but with appropriate adjustments for the target and source schemas.

For more insights on workplace engagement, check out this blog post. They offer valuable strategies to keep your team motivated. Additionally, if you are interested in compliance matters, refer to this resource, which discusses essential employer reminders.

If you’re looking for a career opportunity, visit this page for excellent resources related to job openings.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *