Sytem commit number (SCN)
- identifies the committed version of a database
Change vector
- contains the information necessary to change one block from one consistent state to another consistent state
Begin transaction
- Undo segment binding
- Slot allocation in the transaction table
- Undo block allocation
- Finds an SCN value
- Updates the transaction table
- Puts the current undo block into the free block pool (under some condition)
- Creates a commit record in the redo log buffer
- Flushes the redo log buffer to disk (for durability)
- Releases locks held on rows and tables
Tom Kyte wrote a section "What Does a COMMIT Do?" in his book "Expert Oracle Database Architecture" (pp 292-98). There are two points I would like to add based on his book.
1. When Oracle issues a COMMIT, LGWR writes all of the remaining redo log entries to disk. Considering commit after inserting one row into a table compared to after inserting 1M rows, the time for commit in these two cases is almost same, why? Because redo info is being written to the disk during the inserting process batch by batch. At COMMIT, the remaining redo entries be flushed is thus small. The cost of COMMIT is not a function of the transaction size.
2. When COMMIT, some of the blocks the transaction modified will be visited and "cleaned out" in a fast mode if they are still in the buffer cache. Block cleanout refers to the cleaning out the transaction information stored in the database block header.
Modifying a data block
- Find an interested transaction list (ITL) available in the block
- Lock the row you are modifying
- Generate the redo part of data describing the changes to the data block
- Generate the undo part of data describing
- The inverse operation of data block user changes
- The undo block changes in the undo segment
- The undo segment block changes (if necessary)