| title | Change target recovery time of a database |
|---|---|
| ms.custom | seo-lt-2019 |
| ms.date | 08/24/2016 |
| ms.prod | sql |
| ms.prod_service | database-engine |
| ms.reviewer | |
| ms.technology | supportability |
| ms.topic | conceptual |
| ms.assetid | e466419a-d8a4-48f7-8d97-13a903ad6b15 |
| author | MashaMSFT |
| ms.author | mathoma |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md] This topic describes how to set the change the target recovery time of a [!INCLUDEssNoVersion] database in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql]. By default, the target recovery time is 60 seconds, and the database uses indirect checkpoints. The target recovery time establishes an upper-bound on recovery time for this database.
Note
The upper-bound that is specified for a given database by its target recovery time setting could be exceeded if a long-running transaction causes excessive UNDO times.
-
Before you begin: Limitations and Restrictions, Security
-
To change the target recovery time, using: SQL Server Management Studio or Transact-SQL
Caution
An online transactional workload on a database that is configured for indirect checkpoints could experience performance degradation. Indirect checkpoints make sure that the number of dirty pages are below a certain threshold so that the database recovery completes within the target recovery time. The recovery interval configuration option uses the number of transactions to determine the recovery time as opposed to indirect checkpoints which makes use of the number of dirty pages. When indirect checkpoints are enabled on a database receiving a large number of DML operations, the background writer can start aggressively flushing dirty buffers to disk to ensure that the time required to perform recovery is within the target recovery time set on the database. This can cause additional I/O activity on certain systems, which can contribute to a performance bottleneck if the disk subsystem is operating above or nearing the I/O threshold.
Requires ALTER permission on the database.
To change the target recovery time
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and expand that instance.
-
Expand the Databases container, then right-click the database you want to change, and click the Properties command.
-
In the Database Properties dialog box, click the Options page.
-
In the Recovery panel, in the Target Recovery Time (Seconds) field, specify the number of seconds that you want as the upper-bound of the recovery time for this database.
To change the target recovery time
-
Connect to the instance of [!INCLUDEssNoVersion] where the database resides.
-
Use the following ALTER DATABASE statement, as follows:
TARGET_RECOVERY_TIME = target_recovery_time { SECONDS | MINUTES }
target_recovery_time
Beginning with [!INCLUDEssSQL15_md], the default value is 1 minute. When greater than 0 (the default for older versions), specifies the upper-bound on the recovery time for the specified database in the event of a crash.SECONDS
Indicates that target_recovery_time is expressed as the number of seconds.MINUTES
Indicates that target_recovery_time is expressed as the number of minutes.The following example sets the target recovery time of the [!INCLUDEssSampleDBobject] database to
60seconds.ALTER DATABASE AdventureWorks2012 SET TARGET_RECOVERY_TIME = 60 SECONDS;
Database Checkpoints (SQL Server)
ALTER DATABASE SET Options (Transact-SQL)