暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片
Redo AND Undo
1356
30页
86次
2020-02-17
免费下载
2020-01-20 陈举超
1
Redo and Undo
but in my opinion the single most important feature of Oracle is one that first appeared in
version 6: the change vector, a mechanism for describing changes to data blocks, the heart
of redo and undo.
Basic Data Change 基础数据改变
One of the strangest features of an Oracle database is that it records your data twice. One copy of the data
exists in a set of data files which hold something that is nearly the latest, up-to-date version of your data
(although the newest version of some of the data will be in memory, waiting to be copied to disc); the other
copy of the data exists as a set of instructions—the redo log files—telling you how to re-create the content of
the data files from scratch.
1.1 The Approach 方法
2020-01-20 陈举超
2
Under the Oracle approach to data change, when you issue an instruction to change an item of data, Oracle
doesn’t just go to a data file (or the in-memory copy if the item happens to be buffered), find the item, and
change it. Instead, Oracle works through four critical steps to make the change happen.
Stripped to the bare minimum of detail, these are
1. Create a description of how to change the data item.
2. Create a description of how to re-create the original data item if needed.
3. Create a description of how to create the description of how to re-create the original data item.
4. Change the data item.
The tongue-twisting nature of the third step gives you some idea of how convoluted the mechanism is, but all
will become clear. With the substitution of a few technical labels in these steps, here’s another way of describing
the actions of changing a data block:
1. Create a redo change vector describing the change to the data block.
2. Create an undo record for insertion into an undo block in the undo tablespace.
3. Create a redo change vector describing the change to the undo block.
4. Change the data block.
The exact sequence of steps and the various technicalities around the edges vary depending on the version of
Oracle, the nature of the transaction, how much work has been done so far in the transaction, what the states
of the various database blocks were before you executed the instruction, whether or not you’re looking at the
first change of a transaction, and so on.
1.2 An Example 例:
I’m going to start with the simplest example of a data change, which you might expect to see as you updated a
single row in the middle of an OLTP transaction that had already updated a scattered set of rows. In fact, the
order of the steps in the historic (and most general) case is not the order I’ve listed in the preceding section.
The steps actually go in the order 3, 1, 2, 4, and the two redo change vectors are combined into a single redo
change record and copied into the redo log (buffer) before the undo block and data block are modified (in that
order). This means a slightly more accurate version of my list of actions would be:
of 30
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜