Serializable Isolation (320)

Serializable isolation is suitable for environments:
■ With large databases and short transactions that update only a few rows
■ Where the chance that two concurrent transactions will modify the same rows is
relatively low
■ Where relatively long-running transactions are primarily read only
Serializable isolation permits concurrent transactions to make only those database
changes they could have made if the transactions had been scheduled to run one after
another. Specifically, Oracle permits a serializable transaction to modify a data row
only if it can determine that prior changes to the row were made by transactions that
had committed when the serializable transaction began.

To make this determination efficiently, Oracle uses control information stored in the
data block that indicates which rows in the block contain committed and uncommitted
changes. In a sense, the block contains a recent history of transactions that affected
each row in the block. The amount of history that is retained is controlled by the
INITRANS parameter of CREATE TABLE and ALTER TABLE.

Under some circumstances, Oracle can have insufficient history information to
determine whether a row has been updated by a too recent transaction. This can occur
when many transactions concurrently modify the same data block, or do so in a very
short period. You can avoid this situation by setting higher values of INITRANS for
tables that will experience many transactions updating the same blocks. Doing so
enables Oracle to allocate sufficient storage in each block to record the history of
recent
transactions that accessed the block.

Oracle generates an error when a serializable transaction tries to update or delete data
modified by a transaction that commits after the serializable transaction began:
ORA-08177: Cannot serialize access for this transaction .

When a serializable transaction fails with the Cannot serialize access error, the
application can take any of several actions:
■ Commit the work executed to that point
■ Execute additional (but different) statements (perhaps after rolling back to a
savepoint established earlier in the transaction)
■ Undo the entire transaction

串行化隔离
1. 符合以下特性的系统适合采用串行化隔离:
* 数据量大,但事务短小,只更新少量数据行的数据库
* 两个并发事务修改相同数据的概率相对较少
* 运行时间相对较长的事务只执行只读操作
2. Oracle 在数据块内存储了相关的控制信息,用于记录此块内数据行中所包含的变化。
即数据块内记录了近段时间内对本数据块内数据行进行了修改的事务信息 , 能记录多少条这样的记录
有建表时的参数INITRANS决定
3.
当一个串行化事务试图更新或删除数据,而这些数据在此事务开始后被其他事务修改并进行了提交,
Oracle 将报错:事务不能串行化访问 .
解决方法 :
* 将错误发生点之前的操作提交
* 执行其他操作
* 撤销整个事务

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-989000/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10599713/viewspace-989000/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值