Usage of rollback and commit

First of all, everyone must be clear that COMMIT / ROLLBACK are used after executing DML statements .

The so-called DML statement is INSERT / DELETE / UPDATE / SELECT , and the statement such as CREATE TABLE / VIEW is DDL .

After the DML statement is executed, the processed data will be placed in the rollback segment (except the SELECT statement), waiting for the user to commit (COMMIT) or rollback (ROLLBACK)

. The data in the segment will be deleted.

All DML statements are to be explicitly submitted, the so-called "explicit submission" is to execute COMMIT / ROLLBACK.


Others, such as DDL statements , are implicitly committed. That is, without COMMIT/ROLLBACK. running those

 

After the DML statement , ORACLE has already made an implicit commit, such as CREATE TABLE. After running the script, the table has been created, and you don't need to make an explicit commit.

can be understood visually as


Commit is to submit the data in the database to the rollback segment, which will overwrite the original data


Rollback is to roll back the data in the rollback segment to the database without overwriting the data. Regardless of whether the rollback point has been set before, the data rolled back by rollback will not change unless the commit overwrites the original data.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327039061&siteId=291194637
Recommended