码迷,mamicode.com
首页 > 数据库 > 详细

SQL Server中数据的修改是如何落盘的?

时间:2014-11-20 11:36:23      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   os   sp   for   strong   数据   on   

To understand how the write-ahead log works, it is important for you to know how modified data is written to disk.

SQL Server maintains a buffer cache into which it reads data pages when data must be retrieved.

Data modifications are not made directly to disk, but are made to the copy of the page in the buffer cache.

The modification is not written to disk until a checkpoint occurs in the database, or the modification must be written to disk so the buffer can be used to hold a new page.

Writing a modified data page from the buffer cache to disk is called flushing the page. A page modified in the cache, but not yet written to disk, is called a dirty page.

 

At the time a modification is made to a page in the buffer, a log record is built in the log cache that records the modification.

This log record must be written to disk before the associated dirty page is flushed from the buffer cache to disk.

If the dirty page is flushed before the log record is written, the dirty page creates a modification on the disk that cannot be rolled back if the server fails before the log record is written to disk.

SQL Server has logic that prevents a dirty page from being flushed before the associated log record is written.

Log records are written to disk when the transactions are committed.

 

资料来源

=====================

Write-Ahead Transaction Log

http://technet.microsoft.com/en-us/library/ms186259(v=sql.105).aspx

SQL Server中数据的修改是如何落盘的?

标签:http   io   ar   os   sp   for   strong   数据   on   

原文地址:http://www.cnblogs.com/awpatp/p/4110060.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!