ora-01555
I have been dealing with ora-01555 all day. I guess I was one of the victims of misconception about the rollback segments. Here is a small description of what I understand of “01555” now.
There are three situations that can cause the ORA-01555 error:
1. An active database with an insufficient number of small-sized rollback segments
2. A rollback segment corruption that prevents a consistent read requested by the query
3. A fetch across commits while your cursor is open
Here are some simple rollback segment rules, as per Oracle’s documentation:
1. A transaction can only use one rollback segment to store all of its undo records.
2. Multiple transactions can write to the same extent.
3. The head of the rollback segment never moves into a rollback extent currently occupied by the tail.
4. Extents in the ring are never skipped over and used out of order as the head tries to advance.
5. If the head can’t use the next extent, it allocates another extent and inserts it into the ring.
Two issues that you need to consider when deciding whether your segment is large enough to fit the transaction:
1. Make sure that transactions will not cause the head to wrap around too fast and catch the tail.
2. If you have long-running queries that access frequently changing data, make sure that the rollback segment doesn’t wrap around and prevent the construction of a read-consistent view.
From a developer’s perspective, you can restructure your PL/SQL code to avoid fetching across commits that cause the ORA-01555 error.
these are general guidelines. one must read the oracle documentation to implement/follow these guidelinee.
