ORA-08177 无法连续访问此事务处理

本文探讨了在配置SERIALIZABLE隔离级别时遇到ORA-08177错误的原因及解决方案。通过调整INITRANS参数为较高值,如5,可以避免因历史信息不足导致的错误。
--顺序事务
--设置顺序事务既可以确保用户取得特定时间点的数据,又可以执行DML语句
--会话A
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
select employee_id,first_name,last_name,email from employees where first_name='zou';
--会话B
update employees set last_name='2' where employee_id=2;
--会话A
select employee_id,first_name,last_name,email from employees where first_name='zou';
update employees set email='zou2@foxmail.com' where employee_id=2;

这个时候抛出异常:
ORA-08177 无法连续访问此事务处理

ORACLE: ORA-08177: can't serialize access for this transaction
Q:When I configure SERIALIZABLE isolation level for the channels, I frequently get errors like ORA-08177:Can't serializa access for this transaction. How do I resolve this?
A: Answer for this is best answered by Oracle DB experts. The following is written in Oracle documentation.Oracle database 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. One of the solutions for this problem is set higher value(say 5) in INITRANS to table that throws the ORA-08177 errors. If table name is 'TEST', then you may use the following command: ALTER TABLE TEST INITRANS 5;
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值