Skip to content

Commit 2a01797

Browse files
Merge pull request #36584 from WilliamDAssafMSFT/20260207-for-secondary
20260207 ALTER DATABASE ... FOR SECONDARY
2 parents b600989 + 7a7edd4 commit 2a01797

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

docs/relational-databases/performance/query-store-for-secondary-replicas.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ ALTER DATABASE [Database_Name]
7373
(OPERATION_MODE = READ_WRITE);
7474
```
7575

76+
> [!NOTE]
77+
> Before SQL Server Management Studio (SSMS) version 21, the `FOR SECONDARY` syntax is valid but not recognized by IntelliSense. For SQL Server 2022, SSMS IntelliSense does not recognize the `FOR SECONDARY` syntax as valid, but it is valid.
78+
7679
### Enable automatic plan correction for secondary replicas
7780

7881
**Applies to**: [!INCLUDE [ssSQL22](../../includes/sssql22-md.md)] and later versions, [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)].

docs/t-sql/statements/alter-database-transact-sql-set-options.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to set database options such as Automatic tuning, encrypt
44
author: markingmyname
55
ms.author: maghan
66
ms.reviewer: randolphwest, wiassaf
7-
ms.date: 12/10/2025
7+
ms.date: 02/09/2026
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: reference
@@ -84,6 +84,8 @@ SET
8484
<option_spec> [ ,...n ] [ WITH <termination> ]
8585
}
8686
87+
{ [ FOR SECONDARY ] SET <set_options> }
88+
8789
<option_spec> ::=
8890
{
8991
<accelerated_database_recovery>
@@ -342,6 +344,16 @@ The name of the database to be modified.
342344

343345
Runs the action in the current database. `CURRENT` isn't supported for all options in all contexts. If `CURRENT` fails, provide the database name.
344346

347+
#### FOR SECONDARY
348+
349+
**Applies to**: [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions
350+
351+
Specifies the settings for secondary replicas. All secondary replicas must have the identical values. Similar to `FOR SECONDARY` for [ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)](alter-database-scoped-configuration-transact-sql.md).
352+
353+
For use with the Query Store (`QUERY_STORE`) and Automatic Tuning (`AUTOMATIC_TUNING`) only.
354+
355+
Before SQL Server Management Studio (SSMS) version 21, the `FOR SECONDARY` syntax is valid but not recognized by IntelliSense. For SQL Server 2022, SSMS IntelliSense does not recognize the `FOR SECONDARY` syntax as valid, but it is valid.
356+
345357
#### \<accelerated_database_recovery> ::=
346358

347359
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (Starting with [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)])
@@ -1809,6 +1821,8 @@ SET
18091821
}
18101822
;
18111823
1824+
{ [ FOR SECONDARY ] SET <set_options> }
1825+
18121826
<option_spec> ::=
18131827
{
18141828
<auto_option>
@@ -1957,6 +1971,14 @@ The name of the database to be modified.
19571971

19581972
Controls automatic options.
19591973

1974+
#### FOR SECONDARY
1975+
1976+
Specifies the settings for secondary replicas. All secondary replicas must have the identical values. Similar to `FOR SECONDARY` for [ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)](alter-database-scoped-configuration-transact-sql.md).
1977+
1978+
For use with the Query Store (`QUERY_STORE`) and Automatic Tuning (`AUTOMATIC_TUNING`) only.
1979+
1980+
Before SQL Server Management Studio (SSMS) version 21, the `FOR SECONDARY` syntax is valid but not recognized by IntelliSense.
1981+
19601982
#### <a id="auto_create_statistics"></a> AUTO_CREATE_STATISTICS { ON | OFF }
19611983

19621984
- ON
@@ -2885,6 +2907,8 @@ SET
28852907
}
28862908
;
28872909
2910+
{ [ FOR SECONDARY ] SET <set_options> }
2911+
28882912
<optionspec> ::=
28892913
{
28902914
<auto_option>
@@ -3009,6 +3033,14 @@ The name of the database to be modified.
30093033

30103034
`CURRENT` runs the action in the current database. `CURRENT` isn't supported for all options in all contexts. If `CURRENT` fails, provide the database name.
30113035

3036+
#### FOR SECONDARY
3037+
3038+
Specifies the settings for secondary replicas. All secondary replicas must have the identical values. Similar to `FOR SECONDARY` for [ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)](alter-database-scoped-configuration-transact-sql.md).
3039+
3040+
For use with the Query Store (`QUERY_STORE`) and Automatic Tuning (`AUTOMATIC_TUNING`) only.
3041+
3042+
Before SQL Server Management Studio (SSMS) version 21, the `FOR SECONDARY` syntax is valid but not recognized by IntelliSense.
3043+
30123044
#### \<auto_option> ::=
30133045

30143046
Controls automatic options.

0 commit comments

Comments
 (0)