Skip to content

Commit acc92c6

Browse files
authored
Merge pull request #4429 from CarlRabeler/patch-57
Update alter-database-scoped-configuration-transact-sql.md
2 parents 855c4c6 + 60ac198 commit acc92c6

1 file changed

Lines changed: 23 additions & 26 deletions

File tree

docs/t-sql/statements/alter-database-scoped-configuration-transact-sql.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ ms.workload: "On Demand"
3333
# ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)
3434
[!INCLUDE[tsql-appliesto-ss2016-asdb-xxxx-xxx-md](../../includes/tsql-appliesto-ss2016-asdb-xxxx-xxx-md.md)]
3535

36-
This statement enables several database configuration settings at the **individual database** level. This statement is available in both [!INCLUDE[sqldbesa](../../includes/sqldbesa-md.md)] and in [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)]. Those settings are:
36+
This statement enables several database configuration settings at the **individual database** level. This statement is available in [!INCLUDE[sqldbesa](../../includes/sqldbesa-md.md)] and in SQL Server beginning with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)]. Those settings are:
3737

3838
- Clear procedure cache.
3939

40-
- Set the MAXDOP parameter to an arbitrary value (1,2, ...) for the primary database based on what works best for that particular database and set a different value (e.g. 0) for all secondary database used (e.g. for reporting queries).
40+
- Set the MAXDOP parameter to an arbitrary value (1,2, ...) for the primary database based on what works best for that particular database and set a different value (e.g. 0) for all secondary database used (such as for reporting queries).
4141

4242
- Set the query optimizer cardinality estimation model independent of the database to compatibility level.
4343

@@ -47,7 +47,7 @@ ms.workload: "On Demand"
4747

4848
- Enable or disable the identity cache at the database level.
4949

50-
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
50+
![link icon](../../database-engine/configure-windows/media/topic-link.gif "link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
5151

5252
## Syntax
5353

@@ -81,7 +81,7 @@ MAXDOP **=** {\<value> | PRIMARY }
8181

8282
Specifies the default MAXDOP setting that should be used for statements. 0 is the default value and indicates that the server configuration will be used instead. The MAXDOP at the database scope overrides (unless it is set to 0) the **max degree of parallelism** set at the server level by sp_configure. Query hints can still override the DB scoped MAXDOP in order to tune specific queries that need different setting. All these settings are limited by the MAXDOP set for the Workload Group.
8383

84-
You can use the max degree of parallelism option to limit the number of processors to use in parallel plan execution. SQL Server considers parallel execution plans for queries, index data definition language (DDL) operations, parallel insert, online alter column, parallel stats collectiion, and static and keyset-driven cursor population.
84+
You can use the max degree of parallelism option to limit the number of processors to use in parallel plan execution. SQL Server considers parallel execution plans for queries, index data definition language (DDL) operations, parallel insert, online alter column, parallel stats collection, and static and keyset-driven cursor population.
8585

8686
To set this option at the instance level, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md).
8787

@@ -90,7 +90,7 @@ To set this option at the instance level, see [Configure the max degree of paral
9090
9191
PRIMARY
9292

93-
Can only be set for the secondaries, while the database in on the primary, and indicates that the configuration will be the one set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. **PRIMARY** is the default setting for the secondaries.
93+
Can only be set for the secondaries, while the database in on the primary, and indicates that the configuration will be the one set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitly. **PRIMARY** is the default setting for the secondaries.
9494

9595
LEGACY_CARDINALITY_ESTIMATION **=** { ON | **OFF** | PRIMARY }
9696

@@ -114,7 +114,7 @@ Enables or disables [parameter sniffing](../../relational-databases/query-proces
114114
115115
PRIMARY
116116

117-
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries will be the value set for the primary. If the configuration on the primary for using [parameter sniffing](../../relational-databases/query-processing-architecture-guide.md#ParamSniffing) changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. This is the default setting for the secondaries.
117+
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries will be the value set for the primary. If the configuration on the primary for using [parameter sniffing](../../relational-databases/query-processing-architecture-guide.md#ParamSniffing) changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitly. This is the default setting for the secondaries.
118118

119119
QUERY_OPTIMIZER_HOTFIXES **=** { ON | **OFF** | PRIMARY }
120120

@@ -126,7 +126,7 @@ Enables or disables query optimization hotfixes regardless of the compatibility
126126
127127
PRIMARY
128128

129-
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries will be the value set for the primary. If the configuration for the primary changes, the value on the secondaries will change accordingly without the need to set the secondaries value explicitely. This is the default setting for the secondaries.
129+
This value is only valid on secondaries while the database in on the primary, and specifies that the value for this setting on all secondaries is the value set for the primary. If the configuration for the primary changes, the value on the secondaries changes accordingly without the need to set the secondaries value explicitly. This is the default setting for the secondaries.
130130

131131
CLEAR PROCEDURE_CACHE
132132

@@ -146,11 +146,11 @@ Enables or disables identity cache at the database level. The default is **ON**.
146146
on the database. This permission can be granted by a user with CONTROL permission on a database.
147147

148148
## General Remarks
149-
While you can configure secondary databases to have different scoped configuration settings from their primary, all secondary databases will use the same configuration. Different settings cannot be configured for individual secondaries.
149+
While you can configure secondary databases to have different scoped configuration settings from their primary, all secondary databases use the same configuration. Different settings cannot be configured for individual secondaries.
150150

151-
Executing this statement will clear the procedure cache in the current database, which means that all queries will have to recompile.
151+
Executing this statement clears the procedure cache in the current database, which means that all queries have to recompile.
152152

153-
For 3-part name queries, the settings for the current database connection for the query will be honored, other than for SQL modules (e.g. procedures, functions, and triggers) that are compiled in the current database context and therefore will use the options of the database in which they reside.
153+
For 3-part name queries, the settings for the current database connection for the query is honored, other than for SQL modules (such as procedures, functions, and triggers) that are compiled in the current database context and therefore uses the options of the database in which they reside.
154154

155155
The ALTER_DATABASE_SCOPED_CONFIGURATION event is added as a DDL event that can be used to fire a DDL trigger. This is a child of the ALTER_DATABASE_EVENTS trigger group.
156156

@@ -161,7 +161,7 @@ on the database. This permission can be granted by a user with CONTROL permissio
161161

162162
- Query hint overrides both the sp_configure and the database scoped setting. If the resource group MAXDOP is set for the workload group:
163163

164-
- If the query hint is set to 0 it is overridden by the resource governor setting.
164+
- If the query hint is set to 0, it is overridden by the resource governor setting.
165165

166166
- If the query hint is not 0, it is capped by the resource governor setting.
167167

@@ -171,15 +171,15 @@ on the database. This permission can be granted by a user with CONTROL permissio
171171

172172
**QUERY_OPTIMIZER_HOTFIXES**
173173

174-
When QUERYTRACEON hint is used to enable the legacy query optimizer or query optimizer hotfixes, it would be an OR condition between the query hint and the database scoped configuration setting, meaning if either is enabled, the options will apply.
174+
When QUERYTRACEON hint is used to enable the legacy query optimizer or query optimizer hotfixes, it would be an OR condition between the query hint and the database scoped configuration setting, meaning if either is enabled, the options apply.
175175

176176
**GeoDR**
177177

178-
Readable secondary databases, e.g. Always On Availability Groups and GeoReplication, use the secondary value by checking the state of the database. Even though we don’t recompile on failover and technically the new primary has queries that are using the secondary settings, the idea is that the setting between primary and secondary will only vary when the workload is different and therefore the cached queries are using the optimal settings, whereas new queries will pick the new settings which are appropriate for them.
178+
Readable secondary databases, e.g. Always On Availability Groups and GeoReplication, use the secondary value by checking the state of the database. Even though recompile does not occur on failover and technically the new primary has queries that are using the secondary settings, the idea is that the setting between primary and secondary only vary when the workload is different and therefore the cached queries are using the optimal settings, whereas new queries pick the new settings that are appropriate for them.
179179

180180
**DacFx**
181181

182-
Since ALTER DATABASE SCOPED CONFIGURATION is a new feature in Azure SQL Database and SQL Server 2016 that affects the database schema, exports of the schema (with or without data) will not be able to be imported into an older version of SQL Server e.g. [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] or [!INCLUDE[ssSQLv14](../../includes/sssqlv14-md.md)]. For example, an export to a [DACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_3) or a [BACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_4) from an [!INCLUDE[ssSDS](../../includes/sssds-md.md)] or [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] database that used this new feature would not be able to be imported into a down-level server.
182+
Since ALTER DATABASE SCOPED CONFIGURATION is a new feature in Azure SQL Database and SQL Server beginning with SQL Server 2016 that affects the database schema, exports of the schema (with or without data) are not be able to be imported into an older version of SQL Server e.g. [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] or [!INCLUDE[ssSQLv14](../../includes/sssqlv14-md.md)]. For example, an export to a [DACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_3) or a [BACPAC](https://msdn.microsoft.com/library/ee210546.aspx#Anchor_4) from an [!INCLUDE[ssSDS](../../includes/sssds-md.md)] or [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] database that used this new feature would not be able to be imported into a down-level server.
183183

184184
## Metadata
185185

@@ -240,17 +240,15 @@ This example sets PARAMETER_SNIFFING to OFF for a primary database in a geo-repl
240240
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING=OFF ;
241241
```
242242

243-
This example sets PARAMETER_SNIFFING for secondary database as it is on primary database
244-
in a geo-replication scenario.
243+
This example sets PARAMETER_SNIFFING for secondary database as it is on primary database in a geo-replication scenario.
245244

246245
```sql
247246
ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING=PRIMARY ;
248247
```
249248

250249
### E. Set QUERY_OPTIMIZER_HOTFIXES
251250

252-
Set QUERY_OPTIMIZER_HOTFIXES to ON for a primary database
253-
in a geo-replication scenario.
251+
Set QUERY_OPTIMIZER_HOTFIXES to ON for a primary database in a geo-replication scenario.
254252

255253
```sql
256254
ALTER DATABASE SCOPED CONFIGURATION SET QUERY_OPTIMIZER_HOTFIXES=ON ;
@@ -289,14 +287,13 @@ ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY_CACHE=OFF ;
289287
* ["I smell a parameter!"](https://blogs.msdn.microsoft.com/queryoptteam/2006/03/31/i-smell-a-parameter/)
290288

291289
### QUERY_OPTIMIZER_HOTFIXES Resources
292-
* [Trace Flags &#40;Transact-SQL&#41;](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md)
290+
* [Trace Flags](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md)
293291
* [SQL Server query optimizer hotfix trace flag 4199 servicing model](https://support.microsoft.com/en-us/kb/974006)
294292

295293
## More information
296-
[sys.database_scoped_configurations &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-database-scoped-configurations-transact-sql.md)
297-
[sys.configurations &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-configurations-transact-sql.md)
298-
[Databases and Files Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/databases-and-files-catalog-views-transact-sql.md)
299-
[Server Configuration Options &#40;SQL Server&#41;](../../database-engine/configure-windows/server-configuration-options-sql-server.md)
300-
[sys.configurations &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-configurations-transact-sql.md)
301-
302-
294+
[sys.database_scoped_configurations](../../relational-databases/system-catalog-views/sys-database-scoped-configurations-transact-sql.md)
295+
[sys.configurations](../../relational-databases/system-catalog-views/sys-configurations-transact-sql.md)
296+
[Databases and Files Catalog Views](../../relational-databases/system-catalog-views/databases-and-files-catalog-views-transact-sql.md)
297+
[Server Configuration Options](../../database-engine/configure-windows/server-configuration-options-sql-server.md)
298+
[sys.configurations](../../relational-databases/system-catalog-views/sys-configurations-transact-sql.md)
299+

0 commit comments

Comments
 (0)