oracle 当前读与一致读
current mode :以当前读到块的时间为基准,主要是在(U,I,D操作中)即使数据在操作开始时的SCN之后被提交的,数据字典的读也是 current mode.
consistent mode:与Select 语句开始的scn 为基准读取数据。
create table test (id varchar2(4));
insert into test values('1');
insert into test values('2');
commit;
打开两个会话:sessin 1 :
begin
update test set id='3' where id='2';
dbms_lock.sleep(10);
commit;
end;
/
Session 2:
begin
update test set id='11' where id='1';
update test set id='22' where id='2';/*当前读,以当前读到的数据块为基准,如果数据块被修改,则去undo中重构数据块*/
commit;
end;
/
session1要先运行,session2要稍后运行,中间不超过sleep时间。
尽管session1先修改了数据,但由于没有提交,session2此的模式为current mode。