设为首页 加入收藏

TOP

Oracle中UNDO与REDO的区别详解(二)
2015-07-24 10:59:47 来源: 作者: 【 】 浏览:4
Tags:Oracle UNDO REDO 区别 详解
ststring2 teststring1 - 清理创建的对象
SQL>drop tablespace test_undo including contents and datafiles;
    alter system set undo_tablespace=undotbs1;
    drop tablespace undotbs2 including contents and datafiles;

三 进一步探讨:

Let’s see what will happen if undo is stored in redo logs only.

如果仅将undo信息存储于redo logs会怎么样?

A redo log can be reused once changes protected by it have been written to datafiles (and archivelogs if database is in archivelog mode).

It implies that if I make a change and do not commit it
- Change is written to a redo log 如果我改变的数据而没提交,此时改变将记录到redo log
- checkpoint takes place 检查点发生
- uncommitted change is written to datafile 后未提交的数据写入了数据文件
- I decide to rollback the change 这时我打算回滚
- If redo log has not been overwritten 如果redo log没被覆盖
. search entire redo log for the undo and then rollback 那么搜素整个redo log进行回滚操作
else (redo log has been overwritten)
. undo information is not available for rollback. 否则将无法回滚,undo信息已丢失!

One might argue that if somehow a redo log is not allowed to be overwritten until it contains active undo, we might be able to manage with undo stored in redo logs only. This solution is not feasible as
- size of redo logs will grow enormously large very soon as thet contain both undo and redo (a user might decide not to end a transaction for months)
- to rollback a change, enormous amount of data in redo logs (both redo and undo) will have to be searched leading to degraded performance
- there will be contention on redo logs as they are being used for both
. writing redo and undo
. reading to rollback a change

有人也许会争论:那就不允许redo log 覆盖undo 信息直到包含新的undo,这样redo log将变得异常大从而影响系统性能!

Hence, undo information has to be stored separately from redo and is used for rolling back uncommited transactions . The undo stored in undo buffers/undo tablespace is additionally used for
- read consistency 读一致性
- flashback query 闪回查询
- flashback version query 闪回版本查询

Reference: http://oracleinaction.com/undo-and-redo-in-oracle/ http://oraclenz.wordpress.com/2008/06/22/differences-between-undo-and-redo/

--------------------------------------- Dylan Presents.

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇再谈ORACLECPROCD进程 下一篇oracle自动维护

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Java 并发工具类:提 (2025-12-25 20:25:44)
·Java面试技巧:如何 (2025-12-25 20:25:41)
·Java并发编程中的线 (2025-12-25 20:25:38)
·C 语言 - cppreferen (2025-12-25 19:50:27)
·《C 语言入门教程》 (2025-12-25 19:50:23)