{"id":2812,"date":"2015-11-12T09:53:23","date_gmt":"2015-11-12T14:53:23","guid":{"rendered":"https:\/\/academy.sqlbak.com\/?p=2812"},"modified":"2023-10-17T05:38:52","modified_gmt":"2023-10-17T09:38:52","slug":"checkpoint","status":"publish","type":"post","link":"https:\/\/academy.sqlbak.com\/checkpoint\/","title":{"rendered":"Checkpoint"},"content":{"rendered":"
Checkpoint is a process that writes current in-memory dirty pages (modified pages) and transaction log records to physical disk. In SQL Server checkpoints are used to reduce the time required for recovery in the event of\u00a0system failure. Checkpoint is regularly issued for each database. The following set of operations starts when checkpoint occurs:<\/p>\n
<\/p>\n
The Database Engine supports four types of checkpoints. While some of them\u00a0are issued automatically in the background, other are triggered by user and some of them are triggered by certain system events.<\/p>\n
An\u00a0<\/strong>automatic\u00a0checkpoint is the most common type that\u00a0is triggered by a background process. Server Configuration Option “Recovery Interval” is used by the SQL Server Database Engine to determine how often automatic checkpoints are issued on a given database. You can change it using sp_configure procedure. For example, execute the following command to set the recovery interval to 15 seconds:<\/p>\n In the simple recovery model an automatic checkpoint truncates the unused section of the transaction log. As far as full or bulk-logged recovery model is concerned, the transaction log is not truncated by automatic checkpoint.<\/p>\n A new type of checkpoint introduced in SQL Server 2012 is an\u00a0<\/strong>Indirect checkpoint. Indirect checkpoint\u00a0also runs in the background, but it\u00a0meets user-specified target recovery time for a given database. By default TARGET_RECOVERY_TIME is 0, meaning\u00a0that the database will use automatic checkpoints. If TARGET_RECOVERY_TIME is set to >0, it will override the Recovery Interval specified for the server and avoid automatic checkpoints for that database.<\/p>\n Use the following command to set the target recovery time for a database:<\/p>\n Manual checkpoint runs like any other Transact-SQL command. It runs to completion by default. This type of checkpoint occurs in the current database only. It is also possible to set the time frame\u00a0in which you want your checkpoint completed. Use the following command to issue manual checkpoint:<\/p>\n The fourth\u00a0type is I<\/strong>nternal<\/strong> checkpoint that cannot be controlled by user. It starts following specific transactions, such as:<\/p>\n Checkpoint is a process that writes current in-memory dirty pages (modified pages) and transaction log records to physical disk. In SQL Server checkpoints are used to reduce the time required for recovery in the event of\u00a0system failure. Checkpoint is regularly issued for each database. The following set of operations starts when checkpoint occurs: Log records […]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[],"yoast_head":"\nEXEC<\/span> [sp_configure] 'recovery interval'<\/span>, 15\r\nGO<\/span>\r\nRECONFIGURE<\/span>\r\nGO<\/span><\/span><\/pre>\n
Indirect\u00a0Checkpoint<\/h3>\n
ALTER DATABASE<\/span> database_name<\/em> SET<\/span> TARGET_RECOVERY_TIME = target_recovery_time<\/em> { SECONDS | MINUTES}<\/pre>\n
Manual\u00a0Checkpoint<\/h3>\n
CHECKPOINT [ checkpoint_duration (in seconds)<\/em> ]<\/span><\/span><\/pre>\n
Internal\u00a0Checkpoint<\/h3>\n
\n