SOLVED
ORA-01555: Snapshot Too Old – Causes, Prevention & Fixes
Asked by OracleDba••29 views•oracle
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
ORA-01555: Snapshot Too Old – Causes, Prevention & Fixes
Introduction
If you’ve been working as an Oracle DBA for some time, I can almost guarantee you’ve faced the infamous
ORA-01555: Snapshot Too Old
error at least once. Personally, I still remember the first time I got this error, it was on a production database during month-end reporting, and the developers were chasing me asking,
“Why did my query suddenly fail?”
At that time, I had no clue what undo tablespaces were doing behind the scenes. Later, I realized this error is not just “common,” it’s actually one of the most
evergreen errors
in Oracle databases. Even today, whether you’re on 11g, 12c, 19c, or the latest 23c, ORA-01555 continues to haunt DBAs.
In this article, I’ll take you step by step through what this error means, why it happens, real-world cases where you’ll see it, and most importantly,
how you can fix and prevent it like a pro
.
So, let’s break it down together.
What is ORA-01555: Snapshot Too Old?
The error usually looks like this:
ORA-01555: Snapshot Too Old: rollback segment number X with name "..." too small
In simple words:
Oracle needs
undo data
to reconstruct a consistent read for your query.
If that undo data is overwritten (because the undo tablespace is too small or reused), Oracle can’t fetch the old snapshot.
As a result, your query fails with ORA-01555.
Think of undo as a
time machine
. If the time machine runs out of “fuel,” you can’t go back in time to reconstruct the old data. That’s what “snapshot too old” means.
Why Does ORA-01555 Happen? (The Causes)
Let’s break down the
most common causes
you’ll see in real life.
1. Insufficient Undo Tablespace
The undo tablespace is too small to handle the workload.
Long-running queries need consistent undo for old blocks. If undo runs out, Oracle overwrites older undo.
👉 Example: You have a query scanning millions of rows while other transactions are updating the same table. Undo for the old rows gets overwritten, and boom, ORA-01555.
2. Bad Query Design (Fetching in Loops)
When developers fetch rows one-by-one in PL/SQL loops with a cursor, Oracle may reuse the same undo multiple times.
This is one of the most common mistakes in reporting jobs or ETL scripts.
👉 Example: A PL/SQL procedure with FETCH … INTO … inside a LOOP instead of bulk collect.
3. Long-Running Queries with Concurrent DML
You’re running a heavy SELECT query. Meanwhile, DML (INSERT/UPDATE/DELETE) operations are modifying the same data.
Undo is consumed by these DMLs, and the SELECT can’t reconstruct older versions.
👉 Example: Running month-end reports while batch jobs are updating sales tables.
4. Poor Undo Management (Autoextend OFF)
Undo tablespace not configured with AUTOEXTEND ON.
When it runs out of space, Oracle has no choice but to reuse undo segments prematurely.
5. Undo Tablespace Fragmentation
Even if undo is “large enough,” fragmentation inside undo can cause failures.
Oracle cannot allocate the required contiguous space for undo blocks.
6. LOBs and Undo
Large Objects (CLOB, BLOB) consume significant undo during updates.
If undo is not managed with SecureFiles or NOCACHE settings, snapshot errors are very common.
Real-World Scenarios Where You’ll See ORA-01555
Let me share some
practical DBA war stories
:
Case 1:
A reporting query fetching 10M+ rows was failing every night with ORA-01555. The issue? Developers were using FETCH NEXT in loops.#oracle#error