Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 09:13:31 09月28日 Update

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.

Tags: Transaction disk user information data space this is process problem one-time two password batch limited tag concept system scope statement mirror Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Microsoft MariaDB MySQL