Q           The title is as follows :

stay Oracle in ,UNDO What is the role of ?

A           The answer is as follows :          

UNDO There are mainly the following 3 A role :

1.  Transaction rollback : When a transaction modifies data in a table , The value of the data before modification ( Pre image ) Will be stored in the rollback section , When the user rolls back the transaction (ROLLBACK) when ,Oracle The image before the data in the rollback segment will be used to restore the modified data to the original value .

2.  Transaction recovery : When you're working on a transaction , If the database instance is down due to power failure and other reasons , At this time, the information of the rollback segment is saved in UNDO Tablespace ,Oracle Will be used the next time you open the database UNDO Recover uncommitted data from table space data .

3.  Read consistency :

l  When a session is modifying data , Other sessions will not see uncommitted changes from that session .

l  When a statement is executing , The statement will not see uncommitted changes in other transactions since the statement started execution ( Statement level read consistency ).

l  When Oracle perform SELECT When the sentence is ,Oracle According to the current SCN(System Change Number, System change number ) To make sure that anything ahead of the present SCN The commit statement that should not be changed . for example , When a long query is executing , If another session changes a data block to be queried by the query ,Oracle A read consistent view will be constructed using the data front image of the rollback segment .