CHECKPOINT (T-SQL)

Forces all dirty pages for the current database to be written to disk. Dirty pages are data or log pages that have been modified after they were read into the buffer cache, but the modifications have not yet been written to disk. If the current database is in log truncate mode, CHECKPOINT also truncates the inactive portion of the log. For more information about log truncation, Truncating the Transaction Log.

Syntax

CHECKPOINT

Remarks

The CHECKPOINT statement saves time in a subsequent recovery by creating a point at which all modifications to data and log pages are guaranteed to have been written to disk.

A typical checkpoint takes 1 second to complete, although this figure varies depending on the amount of activity on SQL Server and the size of the data cache.

Checkpoints also occur:

The SHUTDOWN WITH NOWAIT statement shuts down SQL Server without executing a checkpoint in each database. This may cause the subsequent restart to take a longer time than usual to recover the databases on the server.

SQL Server 7.0 also automatically checkpoints any database where the lesser of these two conditions occur:

A database is in log truncate mode when both these conditions are true:

Permissions

Permission to use the CHECKPOINT statement defaults to members of the db_owner fixed database role, and is not transferable.

See Also
Checkpoints and the Active Portion of the Log SHUTDOWN
recovery interval Option sp_dboption
Setting Database Options  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.