Before looking at this article, make sure that you understand the concept of Oracle transactions and locks as it is, but do not understand, refer to the consistency and atomicity of database transactions and Oracle TM and TX Locks
1. Commit a transaction
A transaction can be committed when execution uses a commit statement. When a commit statement is executed, the transaction is confirmed, the transaction is closed, the savepoint is deleted, and the lock is released. Until then, the data associated with the current transaction will be locked until the current transaction commits, and if there are other attempts to manipulate the data in the process (the data is already locking by the current transaction), the other reply will wait or return the error directly.
Note: The data is changed only after committing the transaction and then the commit operation, before committing commits, all logged into the Oracle log system
2. Fallback transaction
Before you say a fallback transaction, the concept and function of the save Point (savepoint) of the Oracle transaction, the SavePoint is a point in the transaction that cancels the partial transaction, and the SavePoint records the state of the current database.
You can use rollback to the specified savepoint to return to the specified savepoint before committing the transaction commit
After the commit of the transaction commits, the savepoint is deleted, and at this time, no fallback is possible.
Before using the savepoint, it is emphasized that any commit operation, that is, the transaction commit operation, will cause savepoint to be deleted!!!
3, rollback to savepoint cancel part of the transaction
Select * from test;savepoint A; -- -Create a fallback point
Then delete a piece of data
Delete from where deptno=ten
Select * from Test;
The data for Ok,depetno 10 is deleted and is now rollback+savepoint with a fallback
rollback to A; Select * from Test;
The data is back, I add a point before deleting the data, then delete the data, and then found that the data can not be deleted, I will go through the savepoint to delete the data before the save point corresponding to the database state
4. Rollback Cancel All transactions
The fallback mechanism is the same as rollback to savepoint, but using rollback is the whole operation of canceling the current transaction, which means that the previous operation of the current transaction is all canceled
Oracle Transactional operations (rollback and commit of transactions)