简体   繁体   中英

Behaviour of serializable transactions in oracle?

I have below sequence of transaction with isolation level as serializable

 trnsaction1                               transaction2

                                           get row2   // value1

 update row1
 update row2//update to 2
 commit

                                           get row1
                                           get row2 //  lin6

will transaction 2 see the updated value of row 1 and row 2. Sure that transaction2 will not see the updated value of row2(update by transaction 1) at line6 but not sure will it see the updated value of row1 updated by transaction1?

Once transaction1 commits its work, transaction 2 will see the updated changes in both of the last two lines. That is, unless you do SET TRANSACTION READ ONLY as the very first action in your transaction.

In a read-write transaction, individual statements are read-consistent, but not between multiple statements.

Edit:

steve, I believe that's incorrect. From the documentation :

[Read commited transaction]

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.

[Serializable]

Serializable transactions see only those changes that were committed at the time the transaction began, plus those changes made by the transaction itself through INSERT, UPDATE, and DELETE statements. Serializable transactions do not experience nonrepeatable reads or phantoms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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