Home / OCI

OCIRunbookAdvanced

Sev1: Autonomous Database storage is full and every insert fails with ORA-65114

Writes to Autonomous Database fail with ORA-65114 while reads still work. Scale storage first, then find what grew, enable storage auto scaling and alarm on StorageUtilization.

Deepak Bhardwaj6 min read

Applies toOracle Autonomous Database Serverless (ATP, ADW, JSON, APEX workloads), ECPU and OCPU models; OCI CLI 3.x

Symptoms

  • Inserts, updates, CREATE TABLE, Data Pump imports and APEX application imports fail with ORA-65114: space usage in container is too high.
  • SELECT queries keep working, so health checks that only read stay green while the application fails.
  • The database Storage chart in the console is at or near 100%.
  • Batch jobs, ETL loads and logging tables fail first because they write the most.

The database is not down. It refuses new space allocation because it has reached its provisioned storage. The quickest fix is more storage, which is an online operation.

1. Confirm scope and impact (2 minutes)

export ADB=ocid1.autonomousdatabase.oc1..xxxx
export COMP=ocid1.compartment.oc1..xxxx

oci db autonomous-database get --autonomous-database-id $ADB \
  --query 'data.{state:"lifecycle-state", model:"compute-model", tb:"data-storage-size-in-tbs", gb:"data-storage-size-in-gbs", autoStorage:"is-auto-scaling-for-storage-enabled", freeTier:"is-free-tier"}' \
  --output table

Check the utilization trend so you know how fast it is filling:

oci monitoring metric-data summarize-metrics-data \
  --compartment-id $COMP --namespace oci_autonomous_database \
  --query-text 'StorageUtilization[5m]{resourceId = "'"$ADB"'"}.max()' \
  --start-time $(date -u -d '-6 hours' +%Y-%m-%dT%H:%M:%SZ)

A steady climb means organic growth or a runaway load. A step change in the last hours usually means a large import, a bad job that loops, or a table copy.

Warning

Always Free Autonomous Databases cannot scale storage. For those, skip to step 3 and free space.

2. Fastest mitigation: add storage

Storage scaling is online. Sessions stay connected and writes resume once the operation completes.

# OCPU model databases: size in TB
oci db autonomous-database update --autonomous-database-id $ADB \
  --data-storage-size-in-tbs 2

# ECPU model databases: size in GB (check which field your database reports in step 1)
oci db autonomous-database update --autonomous-database-id $ADB \
  --data-storage-size-in-gbs 1024

Turn on storage auto scaling at the same time so the database can grow past the provisioned size on its own:

oci db autonomous-database update --autonomous-database-id $ADB \
  --is-auto-scaling-for-storage-enabled true

Watch the state go from SCALE_IN_PROGRESS back to AVAILABLE:

oci db autonomous-database get --autonomous-database-id $ADB \
  --query 'data."lifecycle-state"' --raw-output

If the update fails with a limit error, the compartment or tenancy storage limit or quota is the blocker. Check service limits for Autonomous Database storage in the console and request an increase, then free space in the meantime. Storage is billed by size, so confirm the change with whoever owns the budget once the incident is over. Check current pricing; do not assume.

3. Find what grew

Connect as ADMIN and find the biggest tablespaces and segments:

-- Space by tablespace
SELECT tablespace_name,
       ROUND(SUM(bytes)/1024/1024/1024, 2) AS used_gb
FROM   dba_segments
GROUP  BY tablespace_name
ORDER  BY used_gb DESC;

-- Top 20 segments
SELECT owner, segment_name, segment_type, tablespace_name,
       ROUND(bytes/1024/1024/1024, 2) AS gb
FROM   dba_segments
ORDER  BY bytes DESC
FETCH FIRST 20 ROWS ONLY;

Common causes:

What you see Likely cause Fix
One application table grew sharply today Runaway job, retry loop, duplicate load Stop the job, delete or truncate the bad rows
Many BIN$... segments Dropped tables sitting in the recycle bin Purge the recycle bin of the owning schema
SYSAUX is large Optimizer statistics history, AWR, APEX logs Lower retention, clean up APEX logs
Staging tables from a Data Pump import Failed or repeated import left copies behind Drop the leftover tables with PURGE
Large LOB segments Files, JSON or images stored inline Move large objects to Object Storage

Check the recycle bin, because dropping a table without PURGE frees no space:

SELECT owner, COUNT(*) AS objects,
       ROUND(SUM(space) * 8192/1024/1024/1024, 2) AS approx_gb   -- space is in blocks; block size is 8 KB by default
FROM   dba_recyclebin
GROUP  BY owner
ORDER  BY approx_gb DESC;

4. Free space safely

Caution

TRUNCATE, DROP ... PURGE and PURGE RECYCLEBIN cannot be rolled back, and purged objects cannot be recovered with FLASHBACK TABLE ... TO BEFORE DROP. Confirm the owner and the table name with the application team, and take a note of what you remove. If in doubt, scale storage instead and clean up later.

-- As the schema owner: purge that schema's dropped objects
PURGE RECYCLEBIN;

-- Drop a leftover staging table and release its space immediately
DROP TABLE stage.orders_import_old PURGE;

-- Remove rows from a log table in batches to avoid a huge undo footprint
BEGIN
  LOOP
    DELETE FROM app.request_log
    WHERE  created_at < SYSDATE - 30
    AND    ROWNUM <= 50000;
    EXIT WHEN SQL%ROWCOUNT = 0;
    COMMIT;
  END LOOP;
END;
/

Deleting rows makes the space reusable by that table but does not lower the database storage figure. To return space to the database, shrink the table after the delete:

ALTER TABLE app.request_log ENABLE ROW MOVEMENT;
ALTER TABLE app.request_log SHRINK SPACE;

5. Verify recovery

  • A test write succeeds:
CREATE TABLE admin.sev1_write_test (id NUMBER);
INSERT INTO admin.sev1_write_test VALUES (1);
COMMIT;
DROP TABLE admin.sev1_write_test PURGE;
  • The StorageUtilization metric is clearly below 100% and stable.
  • Application error rates for ORA-65114 return to zero; re-run failed batch jobs and check they did not leave partial data behind.

Communicate

Tell users: "Writes to the database failed between and because the database ran out of storage. Storage has been increased and writes are working. Jobs that failed in that window are being re-run; reads were not affected." List any batch or import jobs that need re-running and who owns them.

Prevent it next time

  • Enable storage auto scaling on every production Autonomous Database (--is-auto-scaling-for-storage-enabled true).
  • Create an alarm on StorageUtilization in oci_autonomous_database, for example StorageUtilization[5m].max() > 80, routed to the on-call topic. A second alarm at 90% should page.
  • Add a write test to the health check, not only SELECT 1 FROM dual.
  • Set retention on log and audit tables and run purge jobs on a schedule.
  • Teach teams to use DROP TABLE ... PURGE for disposable staging tables.
  • After a cleanup, review whether the Autonomous Database shrink operation (console: More actions > Shrink) is worth running to lower the billed storage; it is a long-running operation, so plan it outside peak hours.