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: Export a database to a BACPAC file using the Azure portal, PowerShell, Azure Data Studio, or SQL Server Management Studio.
4
+
description: Export a database to a BACPAC file using the Azure portal, PowerShell, Visual Studio Code, or SQL Server Management Studio.
5
5
author: WilliamDAssafMSFT
6
6
ms.author: wiassaf
7
-
ms.reviewer: mathoma, hudequei
8
-
ms.date: 08/07/2025
7
+
ms.reviewer: mathoma, hudequei, randolphwest
8
+
ms.date: 01/26/2026
9
9
ms.service: azure-sql
10
10
ms.subservice: data-movement
11
11
ms.topic: how-to
@@ -22,37 +22,44 @@ When you need to export a database for archiving or for moving to another platfo
22
22
23
23
## Considerations
24
24
25
-
- For an export to be transactionally consistent, you must ensure either that no write activity is occurring during the export, or that you're exporting from a [transactionally consistent copy](database-copy.md) of your database.
26
-
- If you're exporting to blob storage, the maximum size of a BACPAC file is 200 GB. To archive a larger BACPAC file, export to local storage with SqlPackage.
27
-
-[Import and Export using Private Link](database-import-export-private-link.md) is in preview.
28
-
- The Azure Storage file name can't end with `.` and can't contain special characters like a space character or `<`, `>`, `*`, `%`, `&`, `:`, `\`, `/`, `?`. The file name should be fewer than 128 characters long.
29
-
- If the export operation exceeds 20 hours, it might be canceled. To increase performance during export, you can:
25
+
For an export to be transactionally consistent, you must ensure either that no write activity is occurring during the export, or that you're exporting from a [transactionally consistent copy](database-copy.md) of your database.
30
26
31
-
- Temporarily increase your compute size.
32
-
- Cease all read and write activity during the export.
33
-
- Use a [clustered index](/sql/relational-databases/indexes/clustered-and-nonclustered-indexes-described) with non-null values on all large tables. Without clustered indexes, an export might fail if it takes longer than 6-12 hours. This is because the export service needs to complete a table scan to try to export entire table. A good way to determine if your tables are optimized for export is to run `DBCC SHOW_STATISTICS` and make sure that the *RANGE_HI_KEY* isn't null and its value has good distribution. For details, see [DBCC SHOW_STATISTICS](/sql/t-sql/database-console-commands/dbcc-show-statistics-transact-sql).
34
-
- For larger databases, BACPAC export/import might take a long time, and might fail for various reasons.
35
-
36
-
> [!NOTE]
37
-
> BACPACs are not intended to be used for backup and restore operations. Azure automatically creates backups for every user database. For details, see [business continuity overview](business-continuity-high-availability-disaster-recover-hadr-overview.md) and [Automated backups in Azure SQL Database](automated-backups-overview.md?view=azuresql-db&preserve-view=true) or [Automated backups in Azure SQL Managed Instance](../managed-instance/automated-backups-overview.md?view=azuresql-mi&preserve-view=true).
27
+
If you're exporting to blob storage, the maximum size of a BACPAC file is 200 GB. To archive a larger BACPAC file, export to local storage with SqlPackage.
28
+
29
+
[Import or export an Azure SQL Database by using private link](database-import-export-private-link.md) is in preview.
30
+
31
+
The Azure Storage file name can't end with `.` and can't contain special characters like a space character or `<`, `>`, `*`, `%`, `&`, `:`, `\`, `/`, `?`. The file name should be fewer than 128 characters long.
32
+
33
+
If the export operation exceeds 20 hours, it might be canceled. To increase performance during export, you can:
34
+
35
+
- Temporarily increase your compute size.
36
+
37
+
- Cease all read and write activity during the export.
38
+
39
+
- Use a [clustered index](/sql/relational-databases/indexes/clustered-and-nonclustered-indexes-described) with non-null values on all large tables. Without clustered indexes, an export might fail if it takes longer than 6-12 hours. This is because the export service needs to complete a table scan to try to export entire table. A good way to determine if your tables are optimized for export is to run `DBCC SHOW_STATISTICS` and make sure that the `RANGE_HI_KEY` isn't null and its value has good distribution. For details, see [DBCC SHOW_STATISTICS (Transact-SQL)](/sql/t-sql/database-console-commands/dbcc-show-statistics-transact-sql).
40
+
41
+
- For larger databases, BACPAC export/import might take a long time, and might fail for various reasons.
42
+
43
+
> [!NOTE]
44
+
> BACPACs aren't intended to be used for backup and restore operations. Azure automatically creates backups for every user database. For details, see [business continuity overview](business-continuity-high-availability-disaster-recover-hadr-overview.md) and [Automated backups in Azure SQL Database](automated-backups-overview.md?view=azuresql-db&preserve-view=true) or [Automated backups in Azure SQL Managed Instance](../managed-instance/automated-backups-overview.md?view=azuresql-mi&preserve-view=true).
38
45
39
46
<aid="the-azure-portal"></a>
40
47
41
48
## Export from the Azure portal
42
49
43
-
- You can use the Azure portal to export a BACPAC of a database in an [Azure SQL Database logical server](logical-servers.md).
50
+
- You can use the Azure portal to export a BACPAC of a database in an [Azure SQL Database logical server](logical-servers.md).
44
51
- Using the Azure portal isn't currently supported to export a BACPAC of a database from [Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md).
45
52
46
-
> [!NOTE]
53
+
> [!NOTE]
47
54
> Machines processing import/export requests submitted through the Azure portal or PowerShell need to store the BACPAC file and temporary files generated by the Data-Tier Application Framework (DacFX). The disk space required varies significantly among databases with the same size and can require disk space up to three times the size of the database. Machines running the import/export request only have 450GB local disk space. As a result, some requests might fail with the error `There is not enough space on the disk`. In this case, the workaround is to run SqlPackage on a machine with enough local disk space. Use the [SQLPackage utility](#sqlpackage-utility) to import/export databases larger than 150GB to avoid this issue.
48
55
49
56
1. To export a database using the [Azure portal](https://portal.azure.com), open the page for your database and select **Export** on the toolbar.
50
57
51
-
:::image type="content" source="media/database-export/sql-database-export-menu-button.png" alt-text="Screenshot that highlights the Export button." lightbox="media/database-export/sql-database-export-menu-button.png":::
58
+
:::image type="content" source="media/database-export/sql-database-export-menu-button.png" alt-text="Screenshot that highlights the Export button." lightbox="media/database-export/sql-database-export-menu-button.png":::
52
59
53
60
1. Specify the BACPAC filename, select an existing Azure storage account and container for the export, and then provide the appropriate credentials for access to the source database. A SQL **Server admin login** is needed here even if you're the Azure admin, as being an Azure admin doesn't equate to having admin permissions in Azure SQL Database or Azure SQL Managed Instance.
54
61
55
-
:::image type="content" source="media/database-export/sql-database-export-database.png" alt-text="Screenshot shows the Export Database page with username and password specified.":::
62
+
:::image type="content" source="media/database-export/sql-database-export-database.png" alt-text="Screenshot shows the Export Database page with username and password specified.":::
56
63
57
64
1. Select **OK**.
58
65
@@ -67,12 +74,12 @@ To export a database in SQL Database using the [SQLPackage](/sql/tools/sqlpackag
67
74
This example shows how to export a database using SqlPackage with Active Directory Universal Authentication:
[Azure Data Studio](/azure-data-studio)is a free, open-source tool and is available for Windows, Mac, and Linux. The "SQL Server dacpac" extension provides a wizard interface to SqlPackage operations including export and import. For more information on installing and using the extension, see [SQL Server dacpac extension](/azure-data-studio/extensions/sql-server-dacpac-extension).
82
+
The MSSQL extension for Visual Studio Code is a free, open-source extension available for Windows, macOS, and Linux. The extension includes the [Data-tier Application (Preview)](/sql/tools/visual-studio-code-extensions/mssql/mssql-data-tier-application) experience for SqlPackage operations, including export and import. For more information on installing and using the extension, see the [MSSQL extension for Visual Studio Code](/sql/tools/visual-studio-code-extensions/mssql/mssql-extension-visual-studio-code).
76
83
77
84
## SQL Server Management Studio (SSMS)
78
85
@@ -113,9 +120,10 @@ Use the [Database Operations - Cancel](/rest/api/sql/database-operations/cancel)
- Storage behind a firewall is currently not supported.
125
133
- Immutable storage is currently not supported.
126
134
-[Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md) doesn't currently support exporting a database to a BACPAC file using the Azure portal or Azure PowerShell. To export a managed instance into a BACPAC file, use SQL Server Management Studio (SSMS) or [SQLPackage](/sql/tools/sqlpackage).
127
-
- Currently, the Import/Export service does not support Microsoft Entra ID authentication when MFA is required.
128
-
- Import\Export services only support SQL authentication and Microsoft Entra ID. Import\Export is not compatible with Microsoft Identity application registration.
135
+
- Currently, the Import/Export service doesn't support Microsoft Entra ID authentication when MFA is required.
136
+
- Import\Export services only support SQL authentication and Microsoft Entra ID. Import\Export isn't compatible with Microsoft Identity application registration.
129
137
130
138
## Related content
131
139
132
-
- To learn about long-term backup retention of a single database and pooled databases as an alternative to exporting a database for archive purposes, see [Long-term backup retention](long-term-retention-overview.md). You can use SQL Agent jobs to schedule [copy-only database backups](/sql/relational-databases/backup-restore/copy-only-backups-sql-server) as an alternative to long-term backup retention.
133
-
- To learn about importing a BACPAC to a SQL Server database, see [Import a BACPAC to a SQL Server database](/sql/relational-databases/data-tier-applications/import-a-BACPAC-file-to-create-a-new-user-database).
134
-
- To learn about exporting a BACPAC from a SQL Server database, see [Export a Data-tier Application](/sql/relational-databases/data-tier-applications/export-a-data-tier-application)
135
-
- To learn about using the Data Migration Service to migrate a database, see [Migrate from SQL Server to Azure SQL Database offline using DMS](/azure/dms/tutorial-sql-server-to-azure-sql).
136
-
- If you're exporting from SQL Server as a prelude to migration to Azure SQL Database, see [Migrate a SQL Server database to Azure SQL Database](migrate-to-database-from-sql-server.md).
137
-
- To learn how to manage and share storage keys and shared access signatures securely, see [Security recommendations for Blob storage](/azure/storage/blobs/security-recommendations).
When you use the Import/Export service, the process might take longer than expected. This article describes the potential causes for this delay and alternative workaround methods.
22
22
@@ -32,26 +32,26 @@ The Azure SQL Database Import/Export service provides a limited number of comput
32
32
33
33
Additionally, as the Import/Export service performs a logical backup of the database the time to complete is more dependent on the number of objects in the database than a traditional physical database backup.
34
34
35
-
> [!NOTE]
35
+
> [!NOTE]
36
36
> After resources are assigned and a request starts to process, the service automatically cancels the request after two days.
37
37
38
38
## Recommended solutions
39
39
40
40
If your database exports are used only for recovery from accidental data deletion, all the Azure SQL Database editions provide self-service restoration capability from system-generated backups. But if you need these exports for other reasons, and if you require consistently faster or more predictable import/export performance, consider the following options:
41
41
42
-
-[Export to a BACPAC file by using the SQLPackage utility](./database-export.md#sqlpackage-utility).
43
-
-[Export to a BACPAC file by using Azure Data Studio](./database-export.md#azure-data-studio).
44
-
-[Export to a BACPAC file by using SQL Server Management Studio (SSMS)](./database-export.md#sql-server-management-studio-ssms).
42
+
-[Export to a BACPAC file by using the SQLPackage utility](database-export.md#sqlpackage-utility).
43
+
-[Export to a BACPAC file by using Visual Studio Code](/sql/tools/visual-studio-code-extensions/mssql/mssql-data-tier-application).
44
+
-[Export to a BACPAC file by using SQL Server Management Studio (SSMS)](database-export.md#sql-server-management-studio-ssms).
45
45
- Run the BACPAC import or export directly in your code by using the Microsoft SQL Server Data-Tier Application Framework (DacFx) API. For additional information, see:
46
-
*[Export a data-tier application](/sql/relational-databases/data-tier-applications/export-a-data-tier-application)
## Things to consider when you export or import a database
50
50
51
-
- All the methods discussed in this article consume Database Transaction Units (DTUs) or CPU quota, which causes throttling by the Azure SQL Database service. You can [view the DTU stats for the database on the Azure portal](./monitor-tune-overview.md#azure-sql-database-and-azure-sql-managed-instance-resource-monitoring). If the database has reached its resource limits, [upgrade the service tier](scale-resources.md) to add more resources.
51
+
- All the methods discussed in this article consume Database Transaction Units (DTUs) or CPU quota, which causes throttling by the Azure SQL Database service. You can [view the DTU stats for the database on the Azure portal](monitor-tune-overview.md#azure-sql-database-and-azure-sql-managed-instance-resource-monitoring). If the database has reached its resource limits, [upgrade the service tier](scale-resources.md) to add more resources.
52
52
- Ideally, you should run client applications (like the sqlpackage utility or your custom DAC application) from a VM in the same region as your database. Otherwise, you might experience performance issues related to network latency.
53
53
- Exporting large tables without clustered indexes can be very slow or even cause failure. This behavior occurs because the table can't be split up and exported in parallel. Instead, it must be exported in a single transaction, and that causes slow performance and potential failure during export, especially for large tables.
54
54
55
55
## Related documents
56
56
57
-
[Considerations when exporting a database](./database-export.md#considerations)
57
+
[Considerations when exporting a database](database-export.md#considerations)
0 commit comments