Oracle:Checkpoint&logswitch -- what is their relationship.
2011-08-23 14:06 Tracy. 阅读(367) 评论(0) 编辑 收藏 举报You Asked
Please Tom can you help me to understand what happens at the log switch time and what happens at checkpoint time and how one event can determine the other one. Also i am very confuse where SCN is written: in datafile header, in rolback segment header etc?? thanks a lot with respect razvan
and we said...
A log switch is when we fill up one online redo log and goto the next. A log switch will always initiate a CHECKPOINT (it always starts a checkpoint going). A log switch implies a checkpoint will start. A checkpoint implies nothing about a log switch (checkpoints may be started based on time, number of changed OS blocks, log switches or operator intervention. A checkpoint does not cause a log switch, a log switch causes a checkpoint). So, that is the relationship between the two. The reason a log switch fires a checkpoint is because the system wants to get the blocks in the buffer cache that are "protected" by the online redo log we just filled flushed to disk (so we can reuse that redo log file). If we did not flush these blocks out -- we would need to keep that filled online redo log file until we did flush them out (it is needed to recover those dirty blocks in the event of a failure). So, the log switch fires a checkpoint in anticipation of needing to reuse that redo log file. SCNs are recorded in the datafile headers after during a checkpoint. That lets us know to which point in time a datafile has consistent data for. The SCN is like our internal clock. The SCN is also present in the redo log files. These SCN's are used during recovery to see what log files need to be applied to what datafiles to make them totally consistent. http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/instreco.htm
本文来自博客园,作者:Tracy.,转载请注明原文链接:https://www.cnblogs.com/tracy/archive/2011/08/23/2150506.html