Oracle to PostgreSQL Time-Window Data Reload Implementation Guide
Overview
This guide walks through implementing a solution for reloading data from a specific time window from Oracle to PostgreSQL while maintaining ongoing CDC (Change Data Capture) replication.
Prerequisites
AWS DMS (Database Migration Service) set up with:
Source Oracle endpoint configured
Target PostgreSQL endpoint configured
Replication instance with adequate capacity
Access to both Oracle and PostgreSQL databases with proper permissions
AWS CLI installed and configured on your management workstation
Basic knowledge of SQL, PostgreSQL, and Oracle database concepts
Step 1: Prepare Target PostgreSQL Environment
Create Staging Schema and Tables:
Create Merge Procedure:
Create Monitoring Views:
Step 2: Configure DMS Time-Window Migration
Create DMS Task Settings File: Create a file named
oracle-pg-task-settings.json
with the following content:Create Table Mappings File: Create a file named
oracle-pg-time-window-mapping.json
with the following content (adjust the date range as needed):
Step 3: Create and Run the Orchestration Script
Create the Orchestration Script: Create a file named
oracle-pg-time-window-reload.sh
with the following content:Make the Script Executable:
Run the Orchestration Script:
Step 4: Monitor and Validate the Process
Check Migration Status:
View Merge Logs:
Check for Data Type Issues:
Step 5: Troubleshooting Common Issues
DMS Task Failures:
Check CloudWatch logs for detailed error messages
Verify Oracle supplemental logging is enabled for all source tables
Ensure PostgreSQL target has sufficient disk space
Validate that all Oracle data types are properly mapped to PostgreSQL equivalents
Data Type Conversion Issues:
Oracle NUMBER to PostgreSQL NUMERIC may require explicit precision/scale definitions
Oracle DATE/TIMESTAMP handling might need special conversion rules
Character encoding differences between databases might cause string conversion issues
Merge Procedure Errors:
Check admin.merge_summary for specific error messages
Verify that primary keys are defined correctly in both staging and production tables
Ensure there are no constraint violations during the merge process
Step 6: Finalizing the Process
Cleanup Tasks:
After successful verification, truncate staging tables if needed
Consider deleting the one-time DMS task to save resources
Archive logs for audit purposes
Documentation:
Document the entire process, including any issues encountered and resolutions
Record the time window that was reloaded for future reference
Note any data type conversion or mapping decisions made
Additional Considerations
Performance Optimization:
Increase DMS
MaxFullLoadSubTasks
for larger tablesAdjust PostgreSQL configuration for better bulk load performance (increase
work_mem
,maintenance_work_mem
, etc.)Consider temporarily disabling indexes during the load process
Parallel Ongoing CDC:
Ensure your continuous CDC task doesn't conflict with the time-window reload
Monitor both processes carefully for any signs of interference
Recovery Options:
Create a backup of the target tables before running the merge process
Have a rollback plan in case of issues during the merge
This implementation guide provides a comprehensive approach to selectively reload time-window data from Oracle to PostgreSQL while maintaining ongoing CDC replication.
Last updated
Was this helpful?