4. Business
4.1 Concept of the business
Starting with the first DML statement, either rollback or commit is the closing tag, and all previous DML operations (Insert,update,delete) are within the scope of the transaction.
4.2 Commit operations for a 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
----------
1
Sql> INSERT INTO TT values (2);
1 row created.
Sql> select * from TT;
Id
----------
1
2
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
----------
1
3
sql> rollback; --this business ends here.
Rollback complete.
Sql> select * from TT;
Id
----------
1
2
Two questions:
(1). Committed transactions are not necessarily written on the disk inside
Not necessarily? Because the system reads and writes are asynchronous, the submitted data may still be in the dirty block list, when there are enough dirty blocks
The DBWN process will not write a batch of dirty block information into the disk.
(2). No committed transaction is not written to disk
Not necessarily? Because of the limited space of the dirty list, if a large number of changes are made to the data at one time, a lot of dirty blocks will be out of the dirty block
The length of the linked list, at which time the DBWN process writes the dirty block information to the disk, and if the user commits, the data is already written into the disk,
If the user does a rollback, then Oracle will use the Undo table space to roll back the old mirror to the previous
Restore the rest of the drive back to the disk.
How Oracle starts and shuts down-transaction commit or rollback