ORA-01555

A common error to receive when issuing long-running transactions is `ORA-1555,
`Snapshot too old'.  In the Oracle Server messages manual for this error, the
cause given is `Rollback Segment too small.'  That is misleading, as it is
possible to get this error message with any size rollback segment and
increasing the size of rollback segments may not necessarily help.

When a transaction is started, Oracle keeps track of the time (actually the
SCN) that it was first issued.  While gathering row information to fulfill the
statement, Oracle checks each row to make sure that none of the rows was
modified after the begin date of the current transaction.  If a row is located
which was modified, Oracle goes out to the rollback segment for the value of
that row which existed when the current transaction started.  For uncommitted
changes, the information will always exist in the rollback segment, and there
are no snapshot issues.  However, if there is a change that was committed after
the current transaction started, then the rollback space where that transaction
information is stored may get overwritten by subsequent transactions (or
eliminated entirely by an OPTIMAL shrink).  If Oracle tries to get information
for that row and the rollback transaction no longer exists, a read-consistent
result set cannot be returned and an ORA-1555 error is generated.

No matter what size rollback segment(s) exists on the database, it is possible
for committed transactions to be overwritten.  The larger (and more) rollback
segments that exist in the system, the less often transactions will be
overwritten.  This is the basis for the Server Messages error explanation of
`rollback segment too small'.

Note:  A common (and incorrect) assumption is that the ORA-1555 message
indicates that the rollback segment being used by the current transaction is
too small.  Most commonly it is SELECT statements which generate ORA-1555
errors.  SELECT statements do not generate rollback information.  Rollback
information is generated for a `CREATE TABLE AS SELECT' statement, but it is
the CREATE, rather than the SELECT which does so.

The best way to handle ORA-1555 errors is simply to start the long-running
transaction when there are few (or no) other transactions running against the
database.  So long as there are updates occurring to the table(s) being
accessed, snapshot errors are possible.  If possible, it also helps to split
the transaction into smaller pieces that take less time to run. However, if
neither of these is possible, there are a couple of items to keep in mind when
trying to resolve ORA-1555 errors by modifying rollback configurations:

Make sure all rollback segments are online.  The more segments are online, the
more transactions are spread out and the less often any individual transaction
will be overwritten.  Exceptions to this include cases where there is a massive
rollback segment that is reserved for other uses and tiny rollback segments
that `wrap' head to tail often.  Having such tiny segments online can actually
make a 1555 worse.

Make all rollback segments that are online (except SYSTEM) approximately the
same size.  Transactions are assigned rollback segments in a round-robin
fashion (not exactly, but close enough).  Since a transaction which can cause
an ORA-1555 can appear in any segment (other than SYSTEM), the likelihood of
receiving and ORA-1555 will almost always be dictated by how fast the smallest
rollback segment wraps (and rewrites old transactions)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值