Home > Database > Mysql Tutorial > body text

Oracle PL/SQL之SET TRANSACTION READ ONLY(事务隔离性)

WBOY
Release: 2016-06-07 17:02:48
Original
981 people have browsed it

SET TRANSACTION READ ONLY实际上是实现数据库四大事务(ACID)中隔离性(Isolation)的一种手段,用来将数据的读一致性定在某一

SET TRANSACTION READ ONLY实际上是实现数据库四大事务(ACID)中隔离性(Isolation)的一种手段,,用来将数据的读一致性定在某一时间点,即不管其他事务如何更改数据(不能在当前session中再使用自治事务),在当前事务中进行查询的结果始终不变。由于Oracle的读一致性是通过undo段来实现的,所以如果在此期间DML修改的数据量很大而undo空间设置过小可能会导致ORA-01555(快照过旧)错误。 

Test Code:

Step 1, @session 1(SET TRANSACTION READ ONLY):

Step 2, @session 2(DML, insert a new record):

step 3, @session 1(query the same object and get the same result):

Step 4, @session 1(autonomous transaction is not permitted):

Step 5, @session 1(commit current transaction and we get the change):

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!