简体   繁体   English

oracle中的可序列化隔离级别

[英]Serializable isolation level in oracle

According to this articale serializable isolation level performs read lock as well as range lock on rows. 根据这个明确的可序列化隔离级别执行读锁定以及行上的范围锁定。 So, if in one transaction I perform SELECT statement on some rows(or row), another transactions that will try to query the same rows(or subset of that rows) will lock untill the first one makes a commit or rollback. 因此,如果在一个事务中我对某些行(或行)执行SELECT语句,那么将尝试查询相同行(或该行的子集)的另一个事务将锁定,直到第一个进行提交或回滚。 Right? 对? But in oracle I try to perform such scenario and second transaction have not been locked. 但是在oracle中我试图执行这样的场景并且第二次交易没有被锁定。 Why it doesn't lock until I perform commit in first transaction? 为什么在我在第一次交易中执行提交之前它没有锁定?

Oracle employs multiversionning to guarantee read-consitency without blocking writes: Oracle采用多版本保护来保证读取性能而不会阻止写入:

Read-consistent queries 读一致查询

The data returned by a query is committed and consistent with respect to a single point in time. 查询返回的数据已提交,并且与单个时间点保持一致。

Nonblocking queries 非阻止查询

Readers and writers of data do not block one another 数据的读者和编写者不会互相阻塞

When you perform a SELECT in Read-Committed isolation, the database reconstructs the rows as they were at the beginning of the query so that you have a consistent view of the data (all blocks are retrieved at the same point-in-time). 在Read-Committed隔离中执行SELECT时,数据库会按照查询开头处的行重建这些行,以便您具有一致的数据视图(在同一时间点检索所有块)。 Oracle uses undo data to reverse the changes made to the blocks after the query began (also the changes from other uncommited transactions). Oracle使用撤消数据来反转查询开始对块所做的更改(也包括其他未提交事务的更改)。

The principle is the same with the serializable transaction isolation except that Oracle reconstructs the rows as they were at the beginning of the transaction. 原则与可序列化事务隔离相同,除了Oracle在事务开始时重建行。

For further reading, I suggest you take a look at the " Multi-Versioning and Concurrency " chapter from one of Tom Kyte's book. 为了进一步阅读,我建议你看一下Tom Kyte的书中的“ 多版本和并发 ”一章。

Oracle does not take read locks. Oracle不接受读锁定。 They have the CR mechanism. 他们有CR机制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM