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
Copy file name to clipboardExpand all lines: docs/tools/sqlpackage/troubleshooting-issues-and-performance-with-sqlpackage.md
+29-4Lines changed: 29 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to troubleshoot with SqlPackage.
4
4
author: "dzsquared"
5
5
ms.author: "drskwier"
6
6
ms.reviewer: "maghan"
7
-
ms.date: 08/25/2023
7
+
ms.date: 05/31/2024
8
8
ms.service: sql
9
9
ms.subservice: tools-other
10
10
ms.topic: conceptual
@@ -16,9 +16,11 @@ In some scenarios, SqlPackage operations take longer than expected or fail to co
16
16
17
17
## Overall strategy
18
18
19
-
As general guideline, better performance can be obtained via the [.NET Core version](sqlpackage-download.md#windows-net-8) of SqlPackage.
19
+
As general guideline, better performance can be obtained via the [.NET version](sqlpackage-download.md#installation-cross-platform) of SqlPackage instead of the .NET Framework version installed via the DacFramework.msi.
20
20
21
-
1.[Download](sqlpackage-download.md#windows-net-8) the zip for SqlPackage on .NET Core for your operating system (Windows, macOS, or Linux).
21
+
If you're unable to install the SqlPackage [dotnet tool](sqlpackage-download.md#installation-cross-platform), which enables executing SqlPackage commands from the command prompt in any directory:
22
+
23
+
1.[Download](sqlpackage-download.md#installation-file-download-alternative) the zip for SqlPackage on .NET 8 for your operating system (Windows, macOS, or Linux).
22
24
1. Unzip archive as directed on the download page.
23
25
1. Open a command prompt and change directory (`cd`) to the SqlPackage folder.
24
26
@@ -111,6 +113,10 @@ Here are the causes and solutions to work around this error:
111
113
1. If your database has constraints that are using the DEFAULT attribute (where SQL Server assigns a random name to the constraint) and an explicitly named constraint, a constraint with the same name might be created twice. You should use all explicitly named constraints (not using DEFAULT), or all system-defined names (using DEFAULT).
112
114
1. Manually edit the model.xml and rename the constraint with the name experiencing the error to a unique name. This option should be undertaken only if directed by Microsoft support and poses a risk of .bacpac corruption.
113
115
116
+
### Stack overflow exception
117
+
118
+
Intermittent or persistent stack overflow exceptions are often caused by large T-SQL scripts with many nested statements. A parameter for SqlPackage is available on all commands, `/ThreadMaxStackSize:`, which specifies the maximum stack size for the thread running the SqlPackage process. The default value is determined by the .NET version running SqlPackage. Setting a large value can impact overall performance of SqlPackage, however increasing this value may resolve the stack overflow exception caused by nested statements. Refactoring the T-SQL code is recommended to avoid stack overflow exceptions whenever possible, but the `/ThreadMaxStackSize:` parameter can be used as a workaround. When using the `/ThreadMaxStackSize:` parameter, it is recommended to tune repeated operations to the lowest value that resolves the stack overflow exception if performance impact is noted. Be aware that the value is in megabytes (MB), example values for testing as a workaround include 10 and 100.
119
+
114
120
## Diagnostics
115
121
Logs are essential to troubleshooting. Capture the diagnostic logs to a file with the `/DiagnosticsFile:<filename>` parameter.
116
122
@@ -130,7 +136,7 @@ In scenarios where the OS disk space is limited and runs out during the export,
130
136
131
137
During an export process, the table data is compressed in the bacpac file. The use of `/p:CompressionOption` set to `Fast`, `SuperFast`, or `NotCompressed` may improve the export process speed while compressing the output bacpac file less.
132
138
133
-
To obtain the database schema and data while skipping the schema validation, perform an [Export](sqlpackage-export.md) with the property `/p:VerifyExtraction=False`.
139
+
To obtain the database schema and data while skipping the schema validation, perform an [Export](sqlpackage-export.md) with the property `/p:VerifyExtraction=False`. An invalid export may be produced that cannot be imported.
134
140
135
141
## Azure SQL Database
136
142
@@ -143,6 +149,25 @@ The following tips are specific to running import or export against Azure SQL Da
143
149
144
150
For more information on utilizing a PowerShell script to collect more information about an import operation, see [Lesson Learned #211: Monitoring SQLPackage Import Process](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-211-monitoring-sqlpackage-import-process/ba-p/3556382).
145
151
152
+
## Additional resources
153
+
154
+
The [Azure Database Support Blog](https://techcommunity.microsoft.com/t5/azure-database-support-blog/bg-p/AzureDBSupport) contains many articles on troubleshooting and performance tuning for Azure SQL Database, including several articles on SqlPackage.
155
+
156
+
Some of the most relevant articles include:
157
+
158
+
-[Migrating an Azure SQL DB to a SQL MI by utilizing SqlPackage/ADF](https://techcommunity.microsoft.com/t5/azure-database-support-blog/migrating-an-azure-sql-db-to-a-sql-mi-by-utilizing-sqlpackage/ba-p/4061633)
159
+
-[Lesson Learned #446: Simplifying SQLPackage Log Debugging with PowerShell](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-446-simplifying-sqlpackage-log-debugging-with/ba-p/3960502)
160
+
-[How to use Sqlpackage with Managed Identity](https://techcommunity.microsoft.com/t5/azure-database-support-blog/how-to-use-sqlpackage-with-managed-identity/ba-p/3642942)
161
+
-[Lesson Learned #298: Huge duration of database export using sqlpackage](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-298-huge-duration-of-database-export-using/ba-p/3721709)
162
+
-[Lesson Learned #281: Export fails due to system out of memory exception](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-281-export-fails-due-to-system-out-of-memory/ba-p/3715249)
163
+
-[Lesson Learned #281: Troubleshooting CHECK constraint issue importing a bacpac due to business logic](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-281-troubleshooting-check-constraint-issue/ba-p/3715730)
-[Lesson Learned #213: Cannot set the AccessToken property if the Integrated Security has been set](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-213-cannot-set-the-accesstoken-property-if-the/ba-p/3563343)
-[Lesson Learned #32: How to export multiple databases from SQL Server to Bacpac](https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-32-how-to-export-multiple-databases-from-sql/ba-p/369017)
169
+
-[Step By Step: How to use SQLPackage with Access Token](https://techcommunity.microsoft.com/t5/azure-database-support-blog/step-by-step-how-to-use-sqlpackage-with-access-token/ba-p/1407819)
170
+
-[Collation conflict when moving Azure SQL DB to SQL server on-premises or Azure VM using SQLPackage.](https://techcommunity.microsoft.com/t5/azure-database-support-blog/collation-conflict-when-moving-azure-sql-db-to-sql-server-on/ba-p/1547319)
0 commit comments