|
最初由 南来一味凉 发布
[B]
所以说是类似DB2的UR,用Dirty read要准确些。不管它“曾经” “确定”存在过或“现在”“临时存”着在反正都是脏数据。
银行转账本身是经典的事务例子,用哪个隔离级去读它是另一个应用的事。虽然有可能在DB2 UR隔离级读两个帐户的总额有误,但是还是那句话,真正应用在用脏读隔离级去读的不会在乎读的是什么样的脏数据。
没见过涉及银行转账的哪个业务场景是一定需要在脏读隔离级用Oracle的回滚段特性。 [/B]
我不同意你把 Oracle 默认的隔离级别 Read committed 也算做一种脏读,临时存在(Uncommitted Read) 可以认为是脏读,但是确定存在的 (Read committed) 不能算是脏读,就象我们不能否认历史一样。
举个不恰当的例子:如果一个人原来犯过错误,后来改正了。我们不能就认为他没有犯过错误,因为他的确是犯过错误。这就像是 Read committed,我们可以查出他确实犯过错误!
如果一个人仅仅头脑里面想象去抢银行,甚至做了周密的计划,但是他一直没有付诸行动,那我们如果查询出来他抢银行(Uncommitted Read)就是不合理的,这才是真正的脏读。
下面是 Oracle 官方文档对 Read committed 的解释
Read committed
This is the default transaction isolation level. Each query executed by a transaction sees only data that was committed before the query (not the transaction) began. An Oracle query never reads dirty (uncommitted) data.
Because Oracle does not prevent other transactions from modifying the data read by a query, that data can be changed by other transactions between two executions of the query. Thus, a transaction that runs a given query twice can experience both nonrepeatable read and phantoms.
summarizes key differences between read committed and serializable transactions in Oracle.
而且也明确指出 Dirty read 在 Read committed 这种隔离级别下是
Not possible 的。
IBM 对 Uncommitted Read 的定义也是 Also known as DIRTY READ ,May return data that is never committed to the database 。
所以说 Read committed 不能也被模糊地认为是一种 DIRTY READ。 |
|