You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: The dta utility is a command prompt version of Database Engine Tuning Advisor that allows you to use functionality in applications and scripts.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 09/07/2025
6
+
ms.date: 11/18/2025
7
7
ms.service: sql
8
8
ms.subservice: tools-other
9
9
ms.topic: conceptual
@@ -30,7 +30,9 @@ The **dta** utility is the command prompt version of Database Engine Tuning Advi
30
30
> [!NOTE]
31
31
> The Database Engine Tuning Advisor isn't supported for [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)] or [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)]. Instead, consider the strategies recommended in [Monitor and performance tuning in Azure SQL Database and Azure SQL Managed Instance](/azure/azure-sql/database/monitor-tune-overview). For [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], see also the [Database Advisor performance recommendations for Azure SQL Database](/azure/azure-sql/database/database-advisor-implement-performance-recommendations).
32
32
33
-
Like Database Engine Tuning Advisor, the **dta** utility analyzes a workload and recommends physical design structures to improve server performance for that workload. The workload can be a plan cache, a [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)] trace file or table, or a [!INCLUDE [tsql](../../includes/tsql-md.md)] script. Physical design structures include indexes, indexed views, and partitioning. After analyzing a workload, the **dta** utility produces a recommendation for the physical design of databases and can generate the necessary script to implement the recommendation. Workloads can be specified from the command prompt with the `-if` or the `-it` argument. You can also specify an XML input file from the command prompt with the `-ix` argument. In that case, the workload is specified in the XML input file.
33
+
Like Database Engine Tuning Advisor, the **dta** utility analyzes a workload and recommends physical design structures to improve server performance for that workload. The workload can be a plan cache, a [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)] trace file or table, or a [!INCLUDE [tsql](../../includes/tsql-md.md)] script. Physical design structures include indexes, indexed views, and partitioning.
34
+
35
+
After the **dta** utility analyzes a workload, it produces a recommendation for the physical design of databases and can generate the necessary script to implement the recommendation. Workloads can be specified from the command prompt with the `-if` or the `-it` argument. You can also specify an XML input file from the command prompt with the `-ix` argument. In that case, the workload is specified in the XML input file.
@@ -106,6 +111,26 @@ Specifies the maximum number of columns in indexes that **dta** proposes. The ma
106
111
107
112
Specifies the maximum number of key columns in indexes that **dta** proposes. The default value is 16, the maximum value allowed. **dta** also considers creating indexes with included columns. Indexes recommended with included columns might exceed the number of columns specified in this argument.
108
113
114
+
#### -ce *connection_encrypt_option*
115
+
116
+
**Applies to:**[!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions
117
+
118
+
Specifies that the connection is encrypted between the server and the client. Possible values: `yes`, `no`, and `strict`. The default option is `yes`. For more information, see [TDS 8.0](../../relational-databases/security/networking/tds-8.md#strict-connection-encryption).
119
+
120
+
#### -tc
121
+
122
+
**Applies to:**[!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions
123
+
124
+
Specifies whether to trust the server certificate. This parameter is optional, similar to `HostnameInCertificate` used in other tools and connection strings.
125
+
126
+
For more information, see [TDS 8.0](../../relational-databases/security/networking/tds-8.md#additional-changes-to-connection-string-encryption-properties).
127
+
128
+
#### -hc *hostname_in_certificate*
129
+
130
+
**Applies to:**[!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions
131
+
132
+
Specifies a different, expected CN or SAN in the server certificate to use during server certificate validation. For more information, see [TDS 8.0](../../relational-databases/security/networking/tds-8.md#additional-changes-to-connection-string-encryption-properties).
133
+
109
134
#### -D *database_name*
110
135
111
136
Specifies the name of each database that is to be tuned. The first database is the default database. You can specify multiple databases by separating the database names with commas, for example:
@@ -120,7 +145,7 @@ Alternatively, you can specify multiple databases by using the `-D` argument for
120
145
dta -D database_name1 -D database_name2... n
121
146
```
122
147
123
-
The `-D` argument is mandatory. If the `-d` argument hasn't been specified, **dta** initially connects to the database that is specified with the first `USE database_name` clause in the workload. If there isn't explicit `USE database_name` clause in the workload, you must use the `-d` argument.
148
+
The `-D` argument is mandatory. If the `-d` argument isn't specified, **dta** initially connects to the database that is specified with the first `USE database_name` clause in the workload. If there isn't explicit `USE database_name` clause in the workload, you must use the `-d` argument.
124
149
125
150
For example, if you have a workload that contains no explicit `USE database_name` clause, and you use the following **dta** command, a recommendation isn't generated:
126
151
@@ -146,7 +171,7 @@ If multiple database names are specified, then **dta** returns an error. The `-d
146
171
147
172
If you're using an XML input file, you can specify the first database to which **dta** connects by using the **DatabaseToConnect** element that is located under the **TuningOptions** element. For more information, see [Database Engine Tuning Advisor](../../relational-databases/performance/database-engine-tuning-advisor.md).
148
173
149
-
If you're tuning only one database, the `-d` argument provides functionality that is similar to the `-d` argument in the **sqlcmd** utility, but it doesn't execute the `USE`*database_name* statement. For more information, see [sqlcmd Utility](../sqlcmd/sqlcmd-utility.md).
174
+
If you're tuning only one database, the `-d` argument provides similar functionality to the `-d` argument in the **sqlcmd** utility, but it doesn't execute the `USE`*database_name* statement. For more information, see [sqlcmd Utility](../sqlcmd/sqlcmd-utility.md).
150
175
151
176
#### -E
152
177
@@ -167,7 +192,7 @@ If a table is used, specify its name in the format: *[database_name].[owner_name
167
192
If a file is used, specify `.xml` as its extension. For example, `TuningLog.xml`.
168
193
169
194
> [!NOTE]
170
-
> The **dta** utility doesn't delete the contents of user-specified tuning log tables if the session is deleted. When tuning large workloads, we recommend that a table is specified for the tuning log. Since tuning large workloads can result in large tuning logs, the sessions can be deleted much faster when a table is used.
195
+
> The **dta** utility doesn't delete the contents of user-specified tuning log tables if the session is deleted. When tuning large workloads, we recommend that a table is specified for the tuning log. Since tuning large workloads can result in large tuning logs, the sessions can be deleted faster when a table is used.
171
196
172
197
#### -F
173
198
@@ -259,7 +284,7 @@ The following table shows the default values for each:
259
284
260
285
#### -ix *input_XML_file_name*
261
286
262
-
Specifies the name of the XML file containing **dta** input information. This must be a valid XML document conforming to `DTASchema.xsd`. Conflicting arguments specified from the command prompt for tuning options override the corresponding value in this XML file. The only exception is if a user-specified configuration is entered in the evaluate mode in the XML input file. For example, if a configuration is entered in the **Configuration** element of the XML input file and the **EvaluateConfiguration** element is also specified as one of the tuning options, the tuning options specified in the XML input file override any tuning options entered from the command prompt.
287
+
Specifies the name of the XML file containing **dta** input information. This XML document must conform to the `DTASchema.xsd` schema. Conflicting arguments specified from the command prompt for tuning options override the corresponding value in this XML file. The only exception is if a user-specified configuration is entered in the evaluate mode in the XML input file. For example, if a configuration is entered in the **Configuration** element of the XML input file and the **EvaluateConfiguration** element is also specified as one of the tuning options, the tuning options specified in the XML input file override any tuning options entered from the command prompt.
263
288
264
289
#### -k *maxtotalindexes*
265
290
@@ -287,7 +312,7 @@ If indexes are created online, `ONLINE` = `ON` is appended to its object definit
287
312
288
313
#### -n *number_of_events*
289
314
290
-
Specifies the number of events in the workload that **dta** should tune. If this argument is specified and the workload is a trace file that contains duration information, then **dta** tunes events in decreasing order of duration. This argument is useful to compare two configurations of physical design structures. To compare two configurations, specify the same number of events to be tuned for both configurations and then specify an unlimited tuning time for both also as follows:
315
+
Specifies the number of events in the workload that **dta** should tune. If this argument is specified and the workload is a trace file that contains duration information, then **dta** tunes events in decreasing order of duration. This argument is useful to compare two configurations of physical design structures. To compare two configurations, specify the same number of events to be tuned for both configurations, and then specify an unlimited tuning time for both also as follows:
291
316
292
317
```console
293
318
dta -n number_of_events -A 0
@@ -297,7 +322,7 @@ In this case, it's important to specify an unlimited tuning time (`-A 0`). Other
297
322
298
323
#### -l *time_window_in_hours*
299
324
300
-
Specifies the time window (in hours) when a query must have executed for it to be considered by DTA for tuning when using `-iq` option (Workload from Query Store).
325
+
Specifies the time window (in hours) when a query must have executed for it to be considered for tuning when using `-iq` option (Workload from Query Store).
301
326
302
327
```console
303
328
dta -iq -l 48
@@ -404,13 +429,13 @@ Starts tuning session and exits.
404
429
405
430
## Remarks
406
431
407
-
Press **Ctrl**+**C** once to stop the tuning session and generate recommendations based on the analysis **dta** has completed up to this point. You're prompted to decide whether you want to generate recommendations or not. Press **Ctrl**+**C** again to stop the tuning session without generating recommendations.
432
+
Press **Ctrl**+**C** once to stop the tuning session and generate recommendations, based on the analysis **dta** has completed up to this point. You're prompted to decide whether you want to generate recommendations or not. Press **Ctrl**+**C** again to stop the tuning session without generating recommendations.
408
433
409
434
## Examples
410
435
411
436
### A. Tune a workload that includes indexes and indexed views in its recommendation
412
437
413
-
This example uses a secure connection (`-E`) to connect to the `tpcd1G` database on MyServer to analyze a workload and create recommendations. It writes the output to a script file named `script.sql`. If `script.sql` already exists, then **dta** overwrites the file because the `-F` argument has been specified. The tuning session runs for an unlimited length of time to ensure a complete analysis of the workload (`-A 0`). The recommendation must provide a minimum improvement of 5% (`-m 5`). **dta** should include indexes and indexed views in its final recommendation (`-fa IDX_IV`).
438
+
This example uses a secure connection (`-E`) to connect to the `tpcd1G` database on MyServer to analyze a workload and create recommendations. It writes the output to a script file named `script.sql`. If `script.sql` already exists, then **dta** overwrites the file because the `-F` argument was specified. The tuning session runs for an unlimited length of time to ensure a complete analysis of the workload (`-A 0`). The recommendation must provide a minimum improvement of 5% (`-m 5`). **dta** should include indexes and indexed views in its final recommendation (`-fa IDX_IV`).
### E. Connect with a workload file, overwrite the output file, with tuning options
487
+
488
+
This example shows how to connect with no encryption, include with a workload file, overwrite the output file, tune for 60 minutes, with 5% improvement, and only indexes. Replace `<server>` and `<database>` with valid values.
489
+
490
+
```console
491
+
dta -S <server> -E -ce no -D <database> -if workload_file.sql -F -of output_script.sql -A 60 -m 5 -fa IDX
492
+
```
493
+
494
+
This example is the same as the previous command, but with connection encryption. Replace `<server>` and `<database>` with valid values.
0 commit comments