Oracle Logging

Oracle uses STEAL NO-FORCE logging. The following content is just my
conjecture which is not proved.

 



 

A log record has 2 parts: undo and redo. For Oracle, undo is treated
differently. Undo data is written to pages, which in in turn triggers
redo log writing.

The following transaction update account's credit and level.

-------------
Undo logging
-------------
Redo part
---------
Stored in redo log:

LSN TYPE TID Redo-data
-------------------------
1   SOT  1  
3   UP   1   credit: 100
5   UP   1   level: 2
6   EOT  1

LSN: log sequence number
TID: transaction id
SOT: start of transaction
UP:  update
EOT: end of transaction

Undo part
----------
The following stuff is stored in pages.

TID Undo-data
----------------
1   credit: 90
1   level: 1

The writing of undo part to pages triggers the following redo logging:

LSN TYPE TID Redo-data
-------------------------
2   UP   1   credit: 90
4   UP   1   level: 1

Redo log buffer
----------------
Refer to http://en.wikipedia.org/wiki/Redo_log.

Under the following situations, log records in redo log buffer must be
flushed to online redo log:
1) If a page stealing happens.
2) When committing happens.

References:

 [1] Oracle Database Concepts

 

猜你喜欢

转载自yaojingguo.iteye.com/blog/1845031
今日推荐