How We Cut an Oracle to Aurora PostgreSQL Cutover From 6 Hours to 45 Seconds
Three weeks before a licensing renewal deadline, my team got told to get a 4TB Oracle database off Oracle entirely. Not "reduce core count," not "renegotiate," off. The old plan was a maintenance window: stop the app, export, import, pray, reopen. For a database that size, that's an outage measured in hours, and the business had already said no to hours. We ended up doing the cutover in under a…
In three weeks, a team was instructed to migrate a 4TB Oracle database to PostgreSQL before a licensing renewal deadline. The traditional plan involved a maintenance window with app shutdown, export, import, and reopening, which was unacceptable for the business. The team decided to complete the migration in under a minute using AWS Database Migration Service (DMS).
DMS performs two tasks: a full load, which reads Oracle tables and copies data into Aurora PostgreSQL, and continuous replication (CDC) by reading Oracle's redo logs through the Oracle LogMiner API and applying those changes to the Aurora target in near real time. The database remains operational during this process. When replication lag reaches zero, the app's connection string is switched to Aurora, resulting in a brief downtime.
However, DMS does not handle schema conversion, which requires a separate tool, AWS Schema Conversion Tool (SCT). SCT reads the Oracle schema and generates the PostgreSQL equivalent, but it flags complex PL/SQL procedures with Oracle-specific packages or syntax that need manual rewriting.
The steps involved in this migration are as follows:
Step 1: Prepare the Oracle source for CDC. Oracle must be in archive log mode, and supplemental logging enabled for row change identification. For tables without a primary key, supplementary logging must be enabled at the table level. If using RDS for Oracle, ensure at least 24 hours of archive logs are available for DMS to work if it falls behind.
Step 2: Convert the schema with SCT. Run an assessment report to identify objects that require manual rework before committing to a timeline. Apply the converted DDL to the Aurora PostgreSQL target, but delay secondary indexes and foreign keys until after the full load, as they slow down bulk inserts.
Step 3: Create the DMS replication instance and endpoints, then configure the task. Set the migration type to full load and ongoing replication. Choose limited LOB mode with a max size based on actual data, not a guess, to improve speed.
Step 4: Allow the full load to complete, then rebuild secondary indexes and constraints on the target.
Step 5: Monitor CDC latency, which should flatten near zero. Stop application writes to Oracle for a few seconds, let the last transactions drain through CDC, verify counts match, and then switch the app to Aurora. The actual downtime is minimal, in this case under a minute.
Several factors can impact this process. Triggers on the target should not be enabled during CDC, as DMS replays the changes those triggers would generate. Ensure no triggers are active to avoid issues during testing. CDC latency is not real-time and depends on workload, network, and replication instance sizing, which can extend to minutes under heavy load.
Undersizing the replication instance will result in a longer cutover window. Tables without primary keys pose challenges for CDC; supplemental logging is required for these tables. PostgreSQL does not support a custom CDC start timestamp, so planning for a rollback or resuming replication from a specific point is necessary.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.