1. 何时触发lgwr,dbwr,chpk等进程    

  2. Log Writer (LGWR)  

  3. LGWR performs sequential writes from the Redo Log Buffer to the online redo log file under the followingsituations:  

  4.     1.When a transaction commits  

  5.     2.When the Redo Log Buffer is one-third full

  6.     3.When there is more than 1 MB of changes recorded in the Redo Log Buffer  

  7.     4.Before DBWn writes modified blocks in the Database Buffer Cache to the data files  

  8.     5.Every three seconds  

  9. .Because the redo is needed for recovery, LGWR confirms the commit operation onlyafter the redo is written todisk.  

  10. LGWR can also call on DBWn to write to the data files.  

  11. Database Writer (DBWn)  

  12. The server process records changes to undo and data blocks in the Database Buffer Cache. DBWn writes thedirty buffers from the Database Buffer Cache to the data files. It ensures that a sufficient number offree buffers(buffers that can be overwritten when server processes need toreadin blocks from the data files) are availablein the Database Buffer Cache. Database performance is improved because server processes make changes onlyin the Database Buffer Cache.  

  13. DBWn defers writing to the data files until one of the following events occurs:  

  14.     Incremental or normal checkpoint

  15.     The number of dirty buffers reaches a threshold value  

  16.     A process scans a specified number of blocks when scanning forfree buffers and cannot find any

  17.     Timeout occurs  

  18.     A ping request inReal Application Clusters (RAC) environment  

  19.     Placing a normal ortemporary tablespace offline  

  20.     Placing a tablespace inread-only mode  

  21.     Dropping or truncating a table

  22. ALTER TABLESPACEtablespace nameBEGIN BACKUP  

  23. 1. 当Buffer Cache中的Dirty List长度达到阀值:  

  24. DBWR将Dirty List中的Dirty Buffer写入磁盘(user Server Process在LRU List中查找free buffer时将碰到的dirty blocks移入Dirty List)  

  25. 2. 当user Server Process在Buffer Cache的LRU List中搜索了过长的时间而仍然没有找到free buffer:  

  26. DBWR直接从LRU List中将Dirty Buffer写入磁盘  

  27. 3. 每过3秒钟:  

  28. DBWR把dirty buffers从LRU List移到Dirty List,一旦Dirty List长度达到阀值,DBWR便将数据写入磁盘  

  29. 4. Checkpoint发生时:  

  30. DBWR把所有的dirty buffers从LRU List移到Dirty List,并且开始写数据  

  31. 5. 当Tablespace开始Hot backup时:  

  32. DBWR把所有属于该表空间的dirty buffers从LRU List移到Dirty List,并且开始写数据  

  33. 6. 当Tablespace offline时:  

  34. DBWR把所有属于该表空间的dirty buffers从LRU List移到Dirty List,并且开始写数据  

  35. 7. 执行Drop时:  

  36. droptable或者index将促使DBWR先将属于该segment的dirty blocks写入磁盘  

  37. checkpoint是一个数据库事件,它将已修改的数据从高速缓存刷新到磁盘,并更新控制文件和数据文件。  

  38. 我们知道了checkpoint会刷新脏数据,但什么时候会发生checkpoint呢?以下几种情况会触发checkpoint。  

  39. 1.当发生日志组切换的时候  

  40. 2.当符合LOG_CHECKPOINT_TIMEOUT,LOG_CHECKPOINT_INTERVAL,fast_start_io_target,fast_start_mttr_target参数设置的时候  

  41. 3.当运行ALTER SYSTEM SWITCH LOGFILE的时候  

  42. 4.当运行ALTER SYSTEM CHECKPOINT的时候  

  43. 5.当运行alter tablespace XXX begin backup,end backup的时候  

  44. 6.当运行alter tablespace ,datafile offline的时候;  


ITPUB相关帖子讨论 http://www.itpub.net/forum.php?mod=viewthread&tid=1775404