Physical Migration of Oracle Databases to Amazon RDS Custom Using RMAN Duplication

Physical Migration of Oracle Databases to Amazon RDS Custom Using RMAN DuplicationMore Info

Organizations are increasingly transitioning their self-managed Oracle databases to AWS managed database services to modernize applications and leverage cloud capabilities. With Amazon RDS Custom, users gain the necessary permissions to conduct a physical migration of Oracle databases into Amazon Relational Database Service (Amazon RDS). In this post, we will outline crucial considerations for migration and provide a step-by-step example of executing a physical migration from a self-managed Oracle database to Amazon RDS Custom using RMAN duplication.

Amazon RDS Custom for Oracle is designed for legacy, custom, and packaged applications that require direct access to the underlying operating system and database environment. This service automates database administration tasks while allowing database administrators the flexibility to customize their database and operating system.

RDS Custom offers the ability to bring your own media, execute custom patching, and configure high availability settings. It streamlines management through automatic provisioning, monitoring, backups, restores, scaling, and more.

Key Factors to Consider for Migration

Several factors influence the database migration to AWS:

  • The acceptable downtime for the application
  • The size of the source database
  • Network connectivity options (public internet, VPN, AWS Direct Connect) and bandwidth between source and target databases
  • The need for a fallback plan
  • Compatibility of source and target Oracle database versions and operating system types
  • Availability of replication tools like AWS Database Migration Service (AWS DMS), Oracle GoldenGate, or third-party tools

Based on these considerations, you can opt for offline or online migration using physical, logical, or a combination of both migration methods. The next sections will detail the steps needed to migrate an Oracle database to Amazon RDS Custom via the RMAN duplicate tool.

Solution Overview

This guide focuses on migrating an Oracle database from Amazon Elastic Compute Cloud (Amazon EC2) to Amazon RDS Custom using RMAN duplication. In a subsequent post, we will demonstrate migrating a self-managed Oracle database to Amazon RDS Custom using Oracle Data Guard.

RMAN supports both backup-based duplication and active database duplication. Active database duplication allows for the live source database to be copied over the network to a destination host without requiring a backup. The RMAN duplicate function can duplicate database files as image copies or backup sets. This article will concentrate on RMAN active database duplication.

Steps for the Source Database Instance

The following actions are to be performed on the source DB instance:

  1. Create a password file.
  2. Generate a parameter file from the source database for the target database.
  3. Transfer the password and parameter files to the target database.
  4. Ensure the source database is in archive log mode.
  5. Configure the tnsnames.ora file on the source DB server for communication with the target.

On the RDS Custom DB instance side, follow these steps:

  1. Edit the parameter file obtained from the source database.
  2. Set up the tnsnames.ora file for connection to the source DB instance.
  3. Prepare the environment for the RDS Custom DB instance.
  4. Pause Amazon RDS Custom automation.
  5. Remove the empty ORCL database on Amazon RDS Custom.
  6. Open the ORCL database in NOMOUNT state using the updated parameter file.
  7. Carry out RMAN active duplication.
  8. Verify the status of the RDS Custom DB instance.
  9. Create the RDSADMIN user and grant necessary privileges.
  10. Resume Amazon RDS Custom automation.

Prerequisites

This guide assumes the following setup:

  • The source database is an Oracle database hosted on Amazon EC2 with Oracle Linux OS.
  • The source database name is ORCL.
  • The target database is an RDS Custom for Oracle DB instance, which can also be applicable for on-premises source DB instances provided there is adequate network connectivity to Amazon Virtual Private Cloud (Amazon VPC).

Prior to initiating your migration, ensure the following:

  • Create an RDS Custom for Oracle DB instance, naming it ORCL (to match the source database). For more instructions, visit Working with Amazon RDS Custom.
  • Set up an Amazon Simple Storage Service (Amazon S3) bucket (use your bucket name where we place <YOUR BUCKET>). This will serve as the destination for copying the parameter and password files from the source database server to the RDS Custom database server. If you already have a bucket, you can use it or transfer files directly via SSH if ports are open.
  • Install and configure the AWS Command Line Interface (AWS CLI) on the source database host. For guidance, refer to Getting Started with the AWS CLI.
  • Confirm network connectivity exists between the source and RDS Custom database servers, ensuring DB port 1521 is accessible.

Source Database Instance Steps

In this section, we will outline the steps to perform on the source DB instance.

Create a Password File

Log in to the source database host as the OS user who owns the Oracle database installation. Set the appropriate environment variables for the source database:

$ echo $ORACLE_HOME
/u01/app/oracle/
$ echo $ORACLE_SID
ORCL 

Generate a password file using orapwd:

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwORCL

Confirm by listing the file:

ls -r $ORACLE_HOME/dbs/orapwORCL

Create a Parameter File for the Target Database

Log in as sysdba and create a parameter file:

$ sqlplus / as sysdba 
SQL> create pfile='/tmp/initORCL.ora' from spfile; 

Validate the creation by listing the file:

ls -r /tmp/initORCL.ora

Transfer the Password and Parameter Files

Use Amazon S3 or SSH, depending on your VPC configuration, to copy the files to the RDS Custom database server. Here’s how to copy the files to Amazon S3:

$ aws s3 cp /tmp/initORCL.ora s3://<YOUR BUCKET>
$ aws s3 cp $ORACLE_HOME/dbs/orapwORCL s3://<YOUR BUCKET>

Verify the files by listing the bucket and its objects:

$ aws s3 ls <YOUR BUCKET>
2021-10-26 20:36:21          initORCL.ora
2021-10-26 20:36:21          orapwORCL 

If you encounter any issues connecting to the S3 bucket, check the bucket permissions and connection to Amazon S3. For any difficulties with the AWS CLI, refer to this resource, they are an authority on this subject.

By following these procedures, you can successfully migrate your Oracle database to Amazon RDS Custom, ensuring a smooth transition to the cloud.


Comments

Leave a Reply

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