Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit a8f5321

Browse files
committed
Article refresh, and fix issue 7362
1 parent ef48b80 commit a8f5321

1 file changed

Lines changed: 62 additions & 70 deletions

File tree

Lines changed: 62 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,70 @@
11
---
2-
title: "Change target recovery time of a database"
2+
title: Change target recovery time of a database
33
description: Learn how to set or change the target recovery time of a SQL Server database in SQL Server by using SQL Server Management Studio or Transact-SQL.
4-
ms.date: "08/24/2016"
4+
author: "MashaMSFT"
5+
ms.author: "mathoma"
6+
ms.reviewer: randolphwest
7+
ms.date: 08/26/2022
58
ms.prod: sql
6-
ms.prod_service: "database-engine"
7-
ms.reviewer: ""
89
ms.technology: supportability
910
ms.topic: conceptual
10-
ms.assetid: e466419a-d8a4-48f7-8d97-13a903ad6b15
11-
author: "MashaMSFT"
12-
ms.author: "mathoma"
13-
ms.custom: "seo-lt-2019"
11+
ms.custom: seo-lt-2019
1412
---
15-
# Change the Target Recovery Time of a Database (SQL Server)
13+
# Change the target recovery time of a database (SQL Server)
14+
15+
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
16+
17+
This article describes how to set or change the target recovery time of a database in [!INCLUDE[ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)]. 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.
18+
19+
This setting takes effect immediately, and doesn't require a restart of [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)].
1620

17-
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
18-
This topic describes how to set or change the target recovery time of a database in [!INCLUDE[ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)]. 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.
19-
2021
> [!NOTE]
21-
> 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.
22-
23-
- **Before you begin:** [Limitations and Restrictions](#Restrictions), [Security](#Security)
24-
25-
- **To change the target recovery time, using:** [SQL Server Management Studio](#SSMSProcedure) or [Transact-SQL](#TsqlProcedure)
26-
27-
## <a name="BeforeYouBegin"></a> Before You Begin
28-
29-
### <a name="Restrictions"></a> Limitations and Restrictions
30-
31-
> [!CAUTION]
32-
> 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.
33-
34-
### <a name="Security"></a> Security
35-
36-
#### <a name="Permissions"></a> Permissions
37-
Requires ALTER permission on the database.
38-
39-
## <a name="SSMSProcedure"></a> Using SQL Server Management Studio
40-
**To change the target recovery time**
41-
42-
1. In **Object Explorer**, connect to an instance of the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)], and expand that instance.
43-
44-
2. Expand the **Databases** container, then right-click the database you want to change, and click the **Properties** command.
45-
46-
3. In the **Database Properties** dialog box, click the **Options** page.
47-
48-
4. 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.
49-
50-
## <a name="TsqlProcedure"></a> Using Transact-SQL
51-
**To change the target recovery time**
52-
53-
1. Connect to the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] where the database resides.
54-
55-
2. Use the following [ALTER DATABASE](../../t-sql/statements/alter-database-transact-sql-set-options.md) statement, as follows:
56-
57-
TARGET_RECOVERY_TIME **=** _target_recovery_time_ { SECONDS | MINUTES }
58-
59-
*target_recovery_time*
60-
Beginning with [!INCLUDE[ssSQL15_md](../../includes/sssql16-md.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.
61-
62-
SECONDS
63-
Indicates that *target_recovery_time* is expressed as the number of seconds.
64-
65-
MINUTES
66-
Indicates that *target_recovery_time* is expressed as the number of minutes.
67-
68-
The following example sets the target recovery time of the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database to `60` seconds.
69-
70-
```
71-
ALTER DATABASE AdventureWorks2012 SET TARGET_RECOVERY_TIME = 60 SECONDS;
72-
```
73-
74-
## See Also
75-
[Database Checkpoints &#40;SQL Server&#41;](../../relational-databases/logs/database-checkpoints-sql-server.md)
76-
[ALTER DATABASE SET Options &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-set-options.md)
77-
78-
22+
> 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.
23+
24+
## Limitations and restrictions
25+
26+
An online transactional workload on a database that is configured for [indirect checkpoints](database-checkpoints-sql-server.md#IndirectChkpt) 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 that make use of the number of dirty pages.
27+
28+
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 extra 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.
29+
30+
## Permissions
31+
32+
Requires ALTER permission on the database.
33+
34+
## Use SQL Server Management Studio
35+
36+
1. In **Object Explorer**, connect to an instance of the [!INCLUDE[ssDEnoversion](../../includes/ssdenoversion-md.md)], and expand that instance.
37+
38+
1. Expand the **Databases** container, then right-click the database you want to change, and select the **Properties** command.
39+
40+
1. In the **Database Properties** dialog box, select the **Options** page.
41+
42+
1. 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.
43+
44+
## Use Transact-SQL
45+
46+
1. Connect to the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] where the database resides.
47+
48+
1. Use the following [ALTER DATABASE](../../t-sql/statements/alter-database-transact-sql-set-options.md) statement as follows:
49+
50+
TARGET_RECOVERY_TIME = *target_recovery_time* { SECONDS | MINUTES }
51+
52+
*target_recovery_time*
53+
Beginning with [!INCLUDE[ssSQL16_md](../../includes/sssql16-md.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.
54+
55+
SECONDS
56+
Indicates that *target_recovery_time* is expressed as the number of seconds.
57+
58+
MINUTES
59+
Indicates that *target_recovery_time* is expressed as the number of minutes.
60+
61+
The following example sets the target recovery time of the [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database to `60` seconds.
62+
63+
```sql
64+
ALTER DATABASE AdventureWorks2019 SET TARGET_RECOVERY_TIME = 60 SECONDS;
65+
```
66+
67+
## See also
68+
69+
- [Database Checkpoints &#40;SQL Server&#41;](../../relational-databases/logs/database-checkpoints-sql-server.md)
70+
- [ALTER DATABASE SET Options &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-set-options.md)

0 commit comments

Comments
 (0)