查看redo和undo
select b.name,a.value
from v$mystat a,v$statname b
where a.statistic#=b.statistic# and b.name in ('redo size','undo change vector size');
select b.name,a.value from v$mystat a,v$statname b where a.statistic#=b.statistic# and b.name in ('redo size','undo change vector size');

insert
CREATE TABLE table1(a int);
INSERT INTO table1 VALUES (1);

commit
commit;

select
select * from table1;

update & commit
update table1 set a=2 where a=1;
commit;

rollback
update table1 set a=3 where a=2;
rollback;

update
update table1 set a=4 where a=3;

结论
commit & rollback操作产生undo和redo。
commit提交瞬间,要将最后那些没有提交的redo信息写到redo log file中。
select语句在某些特定的情况下也会产生redo和undo,例如select导致的延迟块清楚发生时。
本文详细探讨了SQL中的undo和redo机制,涉及redo log文件的写入、select语句的影响以及commit和rollback操作如何生成这些变化。重点讲解了事务提交和回滚对数据库状态的影响。
4269

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



