Oracle AWS RDS to Azure Oracle VM Migration Using Data Pump and AzCopy

 

Oracle AWS RDS to Azure Oracle VM Migration Using Data Pump and AzCopy

Architecture

AWS RDS Oracle
      |
      | expdp
      |
DATA_PUMP_DIR
      |
      | RDS S3 Integration
      |
AWS S3 Bucket
      |
      | AzCopy
      |
Azure Blob Storage
      |
      | AzCopy Download
      |
Azure Linux VM
      |
      | impdp
      |
Oracle Database on Azure VM

Step 1: Create Target Schema on AWS RDS

Create the schema and grant required privileges.

CREATE USER HR IDENTIFIED BY "Password";
GRANT CONNECT, RESOURCE TO HR;
ALTER USER HR QUOTA UNLIMITED ON USERS;



Create sample objects and validate data. As shown in the document, a test table and sample records were created before export.


Step 2: Configure AWS RDS S3 Integration

Create S3 Bucket

Example:

aws-rds-export-bucket

Create IAM Policy




Grant access to the S3 bucket.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::aws-rds-export-bucket",
        "arn:aws:s3:::aws-rds-export-bucket/*"
      ]
    }
  ]
}

The document shows creating an IAM policy and attaching it to an IAM role for S3 integration.

Create IAM Role

rds-s3-integration-role

Attach the policy.

Attach Role to RDS

Feature:

S3_INTEGRATION

The document shows attaching the IAM role to the RDS instance using the S3_INTEGRATION feature.




Create Option Group

Add:

S3_INTEGRATION

Modify the RDS instance and associate the option group.





Step 3: Export Schema from AWS RDS

Create Data Pump directory.

Export schema.


Validate dump files.
SELECT *
FROM TABLE(
  rdsadmin.rds_file_util.listdir('DATA_PUMP_DIR')
);

Step 4: Upload Dump File to AWS S3

Use RDS S3 integration.

SELECT rdsadmin.rdsadmin_s3_tasks.upload_to_s3(
       p_bucket_name => 'aws-rds-export-bucket',
       p_directory_name => 'DATA_PUMP_DIR')
AS TASK_ID
FROM dual;

Monitor task status.

SELECT * FROM TABLE(
  rdsadmin.rds_file_util.listdir('DATA_PUMP_DIR')
);



Step 5: Transfer Files from AWS S3 to Azure Blob Storage

Create Azure Storage Account

Example:

storaclemigration

Create container:

oracle-dump

Install AzCopy

On Linux:

wget https://aka.ms/downloadazcopy-v10-linux
tar -xvf downloadazcopy-v10-linux
sudo cp ./azcopy_linux_amd64_*/azcopy /usr/local/bin/

Verify:

azcopy --version

Download Dump from AWS S3

Configure AWS CLI.

aws configure

Copy dump locally.

aws s3 cp \
s3://aws-rds-export-bucket/ \
/u01/migration/ \
--recursive

Upload Dump to Azure Blob Storage

Generate SAS URL.

Example:

https://storaclemigration.blob.core.windows.net/oracle-dump?<SAS_TOKEN>

Upload:

azcopy copy \
"/u01/migration/*" \
"https://storaclemigration.blob.core.windows.net/oracle-dump?<SAS_TOKEN>" \
--recursive=true

Verify:

azcopy list \
"https://storaclemigration.blob.core.windows.net/oracle-dump?<SAS_TOKEN>"

Step 6: Prepare Azure Oracle Linux VM

Create migration directory.

mkdir -p /u01/migration
chown oracle:oinstall /u01/migration

Install Oracle 19c if not already installed.

Verify database.

sqlplus / as sysdba
select name from v$database;

Step 7: Download Dump Files to Azure VM Using AzCopy

azcopy copy \
"https://storaclemigration.blob.core.windows.net/oracle-dump?<SAS_TOKEN>" \
"/u01/migration/" \
--recursive=true

Verify:

ls -ltr /u01/migration

Expected:

expdp_hr.dmp
expdp_hr.log

Step 8: Create Oracle Directory on Azure VM

CREATE OR REPLACE DIRECTORY DPUMP_DIR AS '/u01/migration';

GRANT READ, WRITE ON DIRECTORY DPUMP_DIR TO SYSTEM;

Verify:

SELECT * FROM dba_directories
WHERE directory_name='DPUMP_DIR';

Step 9: Create Target Schema

CREATE USER HR IDENTIFIED BY "Password";

GRANT CONNECT, RESOURCE TO HR;

ALTER USER HR QUOTA UNLIMITED ON USERS;

Step 10: Import Schema into Azure Oracle VM

Full Schema Import

impdp system/password@ORCL \
directory=DPUMP_DIR \
dumpfile=expdp_hr.dmp \
logfile=impdp_hr.log \
schemas=HR

Remap Schema

impdp system/password@ORCL \
directory=DPUMP_DIR \
dumpfile=expdp_hr.dmp \
logfile=impdp_hr.log \
remap_schema=HR:HR_NEW

Parallel Import

impdp system/password@ORCL \
directory=DPUMP_DIR \
dumpfile=expdp_hr_%U.dmp \
logfile=impdp_hr.log \
parallel=4 \
schemas=HR

Step 11: Validation

Object count validation:

SELECT owner,
       object_type,
       COUNT(*)
FROM dba_objects
WHERE owner='HR'
GROUP BY owner, object_type;

Table count validation:

SELECT COUNT(*) FROM HR.EMP;

Invalid objects:

SELECT owner,
       object_name,
       object_type
FROM dba_objects
WHERE status='INVALID';

Conclusion

Using Oracle Data Pump, AWS RDS S3 Integration, AWS S3, Azure Blob Storage, AzCopy, and Oracle Import Data Pump provides a simple and reliable approach for migrating Oracle databases from AWS RDS Oracle to Oracle Database running on Azure Linux VMs with minimal downtime and full schema validation.

Comments