Cutting an Oracle database in half: archiving cold meter data to Amazon S3 and Apache Iceberg 

TL;DR:

In Part 1 we successfully migrated the Oracle HCC-compressed database. Following the migration, the Meter Data Management System (MDMS) database expanded to 110TB (81% capacity) on premium FSx for NetApp ONTAP storage, with the vast majority consisting of cold historical records retained solely for regulatory compliance. 

To curb this growth, we implemented a robust archival pipeline using AWS DMS to move historical data into Amazon S3 in Parquet format, making it queryable via Amazon Athena and Apache Iceberg. By archiving 46% of the dataset, we successfully reclaimed significant allocated storage. This optimization enabled to retire from a full FSx HA pair, cutting our overall storage platform costs by one-third. 

Table of Contents

The Problem 

A Meter Data Management System (MDMS) stores meter readings in Oracle Enterprise Edition, running on EC2 with Oracle ASM backed by Amazon FSx for NetApp ONTAP. The 3 main  tables carried almost the entire load 

In Part 1 Cevo helped to migrate the database to AWS enviroment and hosted the database on EC2. By mid-life the database had grown to 126 TB used / 160 TB allocated (81% full, at FSX it is 110 Tb ), sitting on premium FSx for NetApp ONTAP storage. The uncomfortable truth: the overwhelming majority of that data was cold. Regulatory retention requires keeping years of history, but almost nobody queries a older meter reading on a daily basis. Paying hot-tier prices to store cold data is a losing game.

The table data distribution as following, table names are replaced with dummy names  

Table 

Shape 

What it holds 

APPUSER.METER_READING 

28 cols, billions of rows 

Core interval measurements (monthly partitions, 8 subpartitions) 

APPUSER.METER_READING_CHAR 

14 cols 

Reading characteristics 

APPUSER.METER_READING_LOG 

21 cols + CLOB 

Reading logs, including XML data-area CLOB  

The Storage Layout That Mattered 

The Oracle ASM disk group was carved from LUNs served by an FSx for NetApp ONTAP file system provisioned with 3 HA pairs (three high-availability controller pairs, each contributing throughput and capacity, spread across three ONTAP aggregates). Each pair adds provisioned capacity and throughput which was essential for migration. Reducing the number of LUNs and HA pairs is where the real, durable saving lives. 

The Strategy & Architecture 

Business defined a simple retention rule: purge data older than 7 years permanently, keep the most recent 26 months live in Oracle, and archive everything.  

Everything archived stays fully queryable through Amazon Athena and can be restored back into Oracle on demand. 

Oracle becomes lean; the cold tail lives cheaply in S3 — and, crucially, the freed ASM capacity lets us drop disks and collapse the FSx file system from reduce the HA pair. 

Pipeline Architecture Diagrams 

Level 1 – End-to-End Pipeline Flow: 

Level 2 – Detailed Pipeline with Moving Parts: 

Step 1 – Extraction with AWS DMS 

Using AWS Database Migration Service as the extraction engine. The source endpoint points at Oracle using DMS endpoints; the target endpoint writes Parquet + GZIP to S3. 

As data volume and size is huge rather than one monolithic task, we ran 12 DMS tasks split by year range for each table, using a partitions-list strategy with 8 parallel load threads. Splitting by partition range gave us restartability, parallelism, and per-partition row-count tracking. The METER_READING_LOG table carries a CLOB (an XML data area) requiring explicit LimitedSize LOB settings to move reliably. 

Step 2 – Transforming to Apache Iceberg 

Once the flat Parquet landed in staging, Iceberg was chosen for schema evolution, snapshot-based time travel, and hidden partitioning. 

Defined Iceberg tables in Athena and loaded them with INSERT INTO … SELECT.  

CREATE TABLE mdm_archive_db.meter_reading_iceberg ( 
    reading_key    string, 
    reading_dttm   timestamp, 
    reading_val    decimal(16,6), 
    … 
    reading_year   int, 
    reading_month  int 
) 
PARTITIONED BY (reading_year, reading_month) 
LOCATION ‘s3://mdm-archive/iceberg/meter_reading/’ 
TBLPROPERTIES ( 
    ‘table_type’        = ‘ICEBERG’, 
    ‘format’            = ‘PARQUET’, 
    ‘write_compression’ = ‘ZSTD’ 
); 

The load re-derives partition columns from the timestamp (YEAR/MONTH) and TRIMs every CHAR column to strip Oracle’s fixed-width space padding: 

INSERT INTO mdm_archive_db.meter_reading_iceberg 
SELECT TRIM(reading_key), reading_dttm, TRIM(status_cd), …, 
       YEAR(reading_dttm)  AS reading_year, 
       MONTH(reading_dttm) AS reading_month 
FROM   mdm_archive_db.meter_reading_staging 
WHERE  “$path” LIKE ‘%P2022JAN%’; 


PRACTICAL HICCUP: KMS THROTTLING: The archive bucket is KMS-encrypted. Firing all 89 monthly INSERT queries at once triggered KMS request throttling. Staggering submissions 5 at a time with a 60-second pause between batches turned intermittent failures into a reliable overnight run. 

Step 3 – Reverse ETL: Restoring to Oracle 

Archiving is only safe if restore is trivial. We built an on-demand AWS Glue (PySpark) job — database-reverse-etl — that reads Iceberg data straight from S3 and writes it back into Oracle. It runs on Glue 4.0 with 5 x G.1X workers, reads passwords from Secrets Manager at runtime, and writes via JDBC in 10,000-row batches across 8 partitions. 

CRITICAL DETAIL: CHAR FIDELITY: Oracle CHAR(n) columns are space-padded to their full width. When round-tripping through Parquet, padding is lost. The restore job re-pads every column back to its exact Oracle width using rpad() to prevent silent data drift. 

Step 4 – Purge and Reclaim & FSx Reduction 

With data validated in Iceberg (Athena COUNT(*) reconciled against Oracle per partition), we purged Oracle via Truncate/DROP PARTITION and followed with DROP TABLESPACE. Freeing space inside Oracle did not automatically shrink the FSx footprint due to the three-layer gap (ASM live data vs. ONTAP LUN size-used vs. Volume physical-used). 

Reclaiming capacity required rebalancing ASM, dropping disks evenly across all three ONTAP aggregates, deleting underlying ONTAP volumes, and shrinking FSx. Collapsing from 3 HA pairs to 2 removed a full third of provisioned FSx capacity and throughput. 

Results & Steady State 

Metric 

Before 

After 

Change 

Database Total allocated 

160 TB 

61% 

38% datafiles reclaimed 

Database  Total used 

126 TB 

54% 

46% data freed 

Database  Utilization 

81% 

72% 

+9% 

 

Archiving cold database tables isn’t just about deleting rows to free up disk space—it’s about fundamentally rethinking your storage economics. By pairing AWS DMS and Apache Iceberg with disciplined storage reclamation, it didn’t just shrink a massive database; it permanently collapsed the infrastructure footprint by a third. For teams drowning in hot-tier storage costs for compliance data, open table formats like Iceberg on S3 offer a path that is lean, fully queryable, and effortlessly sustainable at scale. 

Enjoyed this blog?

Share it with your network!