Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The principle of starting and shutting down oracle-transaction commit or rollback

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

4. Transaction

4.1 Concepts of transactions

Starting with the first DML statement and ending with rollback or commit, all previous DML operations (insert,update,delete) fall within the scope of this transaction.

4.2 commit operation of transaction

(1) first unlock a user and change the password

SQL > alter user scott account unlock

User altered.

SQL > alter user scott identified by scott

User altered.

(2) Connect to scott users

SQL > conn scott/scott

Connected.

(3) create a tt table

SQL > create table tt (

2 id number

3)

SQL > insert into tt values (1)

1 row created.

SQL > select * from tt

ID

-

one

SQL > insert into tt values (2)

1 row created.

SQL > select * from tt

ID

-

one

two

SQL > commit;-- this is the end of a transaction

Commit complete.

This is another business.

SQL > update tt set id=3 where id=2

1 row updated.

SQL > select * from tt

ID

-

one

three

SQL > rollback;-- this transaction ends here

Rollback complete.

SQL > select * from tt

ID

-

one

two

Two questions:

(1)。 Will the committed transaction be written to the disk?

Not necessarily? Because the read and write of the system is asynchronous, the submitted data may still be in the dirty block list until there are enough dirty blocks.

The DBWn process will write a batch of dirty block information to disk.

(2)。 Is it true that transactions that are not committed will not be written to disk

Not necessarily? Because the space of the dirty block linked list is limited, if a large number of changes are made to the data at once, a large number of dirty blocks will exceed the dirty blocks.

The length of the linked list. At this point, the DBWn process will write the dirty block information to disk. If the user submits it, the data will already be written to disk.

If the user rolls back, there is no problem. Oracle will use the undo tablespace to roll back the broken old image to send the previous letter

The information is restored to disk.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report