--顺序事务
--设置顺序事务既可以确保用户取得特定时间点的数据,又可以执行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;
--设置顺序事务既可以确保用户取得特定时间点的数据,又可以执行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;
本文探讨了在配置SERIALIZABLE隔离级别时遇到ORA-08177错误的原因及解决方案。通过调整INITRANS参数为较高值,如5,可以避免因历史信息不足导致的错误。
2万+

被折叠的 条评论
为什么被折叠?



