今天复习042的题目时看到这么一句话:
commit只是写日志文件,而不是写数据文件
我就有疑问了,那么事务中提交的数据是什么时候写入数据文件的呢?

解决方案 »

  1.   

    9i版本DBWn进程发生的情况:
    1、超时
    2、没有空闲缓冲区
    3、dirty 数据缓冲区达到阀值
    4、表空间开始备份(begin backup)
    5、表空间offline
    6、drop 或 truncate 表
    7、表空间置为read only
    8、检查点(checkpoint,增量或正常的检查点)
    9、RAC ping 
      

  2.   

     The DBWn process writes dirty buffers to disk under the following conditions:1、When a server process cannot find a clean reusable buffer after scanning a threshold number of buffers, it signals DBWn to write. DBWn writes dirty buffers to disk asynchronously if possible while performing other processing.2、DBWn periodically writes buffers to advance the checkpoint, which is the position in the redo thread from which instance recovery begins (see "Overview of Checkpoints"). The log position of the checkpoint is determined by the oldest dirty buffer in the buffer cache.
      

  3.   

    DBWn负责将脏块写入磁盘的后台进程。
    DBWn会把块写出到所有磁盘,即分散在各个磁盘上,也就是说,DBWn会做大量的分散写(scattered write);
    LGWR则是向重做日志完成大量的顺序写(sequential write)。
    从理论上讲,如果提交期间Oracle已经将已修改的块物理地写出到磁盘,就可以跳过写在线重做日志文件。但实际上,提交期间,只是由LGWR会把每个事务的重做信息写至在线重做日志,DBWn则在后台将数据库块刷新输出到磁盘。
    这么做的原因就是分散写比顺序写慢多了。DBWn 在后台完成它的任务(很慢),而LGWR在用户提交后等待时完成自己的任务(这个任务比较快),就能得到更好的整体性能。尽管从技术上讲这样会使Oracle执行更多不必要的I/O(写日志以及写数据文件)。