Skip to content

Commit c6ec505

Browse files
Merge pull request #29509 from WilliamDAssafMSFT/20240109-import-export-mfa
20240109 edit pass, MFA limitation
2 parents 18da9ca + 561f812 commit c6ec505

2 files changed

Lines changed: 54 additions & 47 deletions

File tree

azure-sql/database/database-export.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,32 @@ description: Export a database to a BACPAC file using the Azure portal, PowerShe
55
author: WilliamDAssafMSFT
66
ms.author: wiassaf
77
ms.reviewer: mathoma, jeschult
8-
ms.date: 09/26/2023
8+
ms.date: 01/09/2024
99
ms.service: sql-db-mi
1010
ms.subservice: data-movement
1111
ms.topic: how-to
12-
ms.custom: sqldbrb=2
13-
monikerRange: "= azuresql || = azuresql-db || = azuresql-mi"
12+
ms.custom:
13+
- sqldbrb=2
14+
monikerRange: "=azuresql||=azuresql-db||=azuresql-mi"
1415
---
1516
# Export to a BACPAC file - Azure SQL Database and Azure SQL Managed Instance
1617

17-
[!INCLUDE[appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
18+
[!INCLUDE [appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
1819

1920
When you need to export a database for archiving or for moving to another platform, you can export the database schema and data to a [BACPAC](/sql/relational-databases/data-tier-applications/data-tier-applications#bacpac) file. A BACPAC file is a ZIP file with an extension of BACPAC containing the metadata and data from the database. A BACPAC file can be stored in Azure Blob storage or in local storage in an on-premises location and later imported back into [Azure SQL Database](sql-database-paas-overview.md), [Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md), or a [SQL Server instance](/sql/database-engine/sql-server-database-engine-overview).
2021

2122
## Considerations
2223

2324
- 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.
2425
- 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.
25-
- Exporting a BACPAC file to Azure premium storage using the methods discussed in this article isn't supported.
26-
- Storage behind a firewall is currently not supported.
27-
- Immutable storage is currently not supported.
28-
- Storage file name or the input value for StorageURI should be fewer than 128 characters long and can't end with '.' and can't contain special characters like a space character or '<, >, *, %, &, :, \, /, ?'.
29-
- If the export operation exceeds 20 hours, it may be canceled. To increase performance during export, you can:
26+
27+
- Storage file name or the input value for StorageURI should be fewer than 128 characters long and can't end with `.` and can't contain special characters like a space character or `<`, `>`, `*`, `%`, `&`, `:`, `\`, `/`, `?`.
28+
- If the export operation exceeds 20 hours, it might be canceled. To increase performance during export, you can:
3029

3130
- Temporarily increase your compute size.
3231
- 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 may 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-
- [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).
35-
- For larger databases, BACPAC export/import may take a long time, and may fail for various reasons.
32+
- 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).
33+
- For larger databases, BACPAC export/import might take a long time, and might fail for various reasons.
3634

3735
> [!NOTE]
3836
> 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).
@@ -45,19 +43,19 @@ When you need to export a database for archiving or for moving to another platfo
4543
Exporting a BACPAC of a database from [Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md) using the Azure portal isn't currently supported. See [Considerations](#considerations).
4644

4745
> [!NOTE]
48-
> Machines processing import/export requests submitted through the Azure portal or PowerShell need to store the BACPAC file as well as 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 may 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. We encourage using [SQLPackage](#sqlpackage-utility) to import/export databases larger than 150GB to avoid this issue.
46+
> Machines processing import/export requests submitted through the Azure portal or PowerShell need to store the BACPAC file as well as 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. We encourage using [SQLPackage](#sqlpackage-utility) to import/export databases larger than 150GB to avoid this issue.
4947
5048
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.
5149

52-
![Screenshot that highlights the Export button.](./media/database-export/database-export1.png)
50+
:::image type="content" source="media/database-export/database-export1.png" alt-text="Screenshot that highlights the Export button." lightbox="media/database-export/database-export1.png":::
5351

54-
2. 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.
52+
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.
5553

56-
:::image type="content" source="./media/database-export/database-export2.png" alt-text="Screenshot shows the Export Database page with username and password specified.":::
54+
:::image type="content" source="media/database-export/database-export2.png" alt-text="Screenshot shows the Export Database page with username and password specified.":::
5755

58-
3. Select **OK**.
56+
1. Select **OK**.
5957

60-
4. To monitor the progress of the export operation, open the page for the server containing the database being exported. Under **Data management**, select **Import/Export history**.
58+
1. To monitor the progress of the export operation, open the page for the server containing the database being exported. Under **Data management**, select **Import/Export history**.
6159

6260
## SQLPackage utility
6361

@@ -83,7 +81,7 @@ The newest versions of SQL Server Management Studio provide a wizard to export a
8381

8482
Exporting a BACPAC of a database from [Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md) using PowerShell isn't supported. See [Considerations](#considerations).
8583

86-
Use the [New-AzSqlDatabaseExport](/powershell/module/az.sql/new-azsqldatabaseexport) cmdlet to submit an export database request to the Azure SQL Database service. Depending on the size of your database, the export operation may take some time to complete.
84+
Use the [New-AzSqlDatabaseExport](/powershell/module/az.sql/new-azsqldatabaseexport) cmdlet to submit an export database request to the Azure SQL Database service. Depending on the size of your database, the export operation might take some time to complete.
8785

8886
```powershell
8987
$exportRequest = New-AzSqlDatabaseExport -ResourceGroupName $ResourceGroupName -ServerName $ServerName `
@@ -111,7 +109,7 @@ $exportStatus
111109
Use the [Database Operations - Cancel](/rest/api/sql/database-operations/cancel) API
112110
or the PowerShell [Stop-AzSqlDatabaseActivity](/powershell/module/az.sql/Stop-AzSqlDatabaseActivity) command to cancel an export request. Here's an example PowerShell command:
113111

114-
```cmd
112+
```powershell
115113
Stop-AzSqlDatabaseActivity -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -OperationId $Operation.OperationId
116114
```
117115

@@ -120,7 +118,15 @@ Stop-AzSqlDatabaseActivity -ResourceGroupName $ResourceGroupName -ServerName $Se
120118
> - The [SQL DB Contributor](/azure/role-based-access-control/built-in-roles#sql-db-contributor) role or
121119
> - A [custom Azure RBAC role](/azure/role-based-access-control/custom-roles) with `Microsoft.Sql/servers/databases/operations` permission
122120
123-
## Next steps
121+
## Limitations
122+
123+
- Exporting a BACPAC file to Azure premium storage using the methods discussed in this article isn't supported.
124+
- Storage behind a firewall is currently not supported.
125+
- Immutable storage is currently not supported.
126+
- [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+
129+
## Related content
124130

125131
- 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.
126132
- 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).

0 commit comments

Comments
 (0)