Committing a transaction
When a session wishes to
commit the changes it made, the redo log entries that belong to that transactions and that are still stored in the
redo log buffer need to be written to disk so that is possible to
recovery the transaction.
This is necessary because the changes might not yet be written to the
data files.
When LGWR writes the redo entries to the
online redo log file, it also assigns an
SCN to be able to identify them again.
When LGWR is finished with everything, it notifies the session that the transaction is now securly safed.
It should be noted that LGWR, in order to reduce I/O, also writes redo log entries of transactions that have not yet been committed. In case of a recovery, these can be rolled back.
Read-only transactions
A transaction can be marked as read only when starting it with
set transaction read only
.
In a read only transaction, only the following statements are allowed:
-
select
statements (without the for update clause)
-
lock table
-
set role
-
alter session
-
alter system
A read only transaction does not see data that was modified and committed after the transaction was started. This behavior is referred to as transaction-level read consistency.
User SYS
cannot set its transaction to read only.