Azure SQL database export stuck at pending

Azure SQL database export stuck at pending

The customer is getting stuck with exporting Azure SQL Database, they tried from Azure Portal and SSMS however after a few hours there was not any progress. We checked all considerations that Microsoft has mentioned here Export a database to a BACPAC file - Azure SQL Database & Azure SQL Managed Instance | Microsoft Learn

Why might export and import do not work?

The Azure SQL Database Import/Export service provides a limited number of compute virtual machines (VMs) per region to process import and export operations. The compute VMs are hosted per region to make sure that the import or export avoids cross-region bandwidth delays and charges. If too many requests are made at the same time in the same region, significant delays can occur in processing the operations. The time that's required to complete requests can vary from a few seconds to many hours. The referral link Import and export of a database takes a long time - Azure SQL Database & Azure SQL Managed Instance | Microsoft Learn

What is alternative way to Export/Import Azure SQL Database?

In this kind of situations, the best thing is using “SQL Package” SQLPackage utility for scale and performance in most production environments. You’ll be able to see more details and also download the latest version of SQLPackage from here SqlPackage - SQL Server | Microsoft Learn

How to export Database with SQL Package?

(1) SQLpackage generally installs in the below location, so open CMD then go where you have it in your computer.

C:\Program Files (x86)\Microsoft SQL Server\<version>\DAC\bin\SqlPackage.exe

How import/export database with SQLpackage?

(2) Export Azure SQL Database to your local computer:

It’s better to create the folder first, in this example I have created “export” folder somewhere in my laptop.

Also, I do suggest to make sure from your laptop you can connect to Azure SQL Database, You might need to check the firewall unless you might get error messages like the below:

(3) Run the below command to export Azure SQL Database in your local computer. You need to replace the server, database name, username and password.

sqlpackage.exe /Action:Export /ssn:tcp:serverbane.database.windows.net,1433 /sdn:databasename /su:username /sp:password /tf:"C:\Users\mattmansoomi\Downloads\SQLPackage\export\export_db.bacpac"

I ran the command for my test lab and as you see it took 15 seconds to export the database in my local computer.

From here you’ll bunch of parameters that could be used in different scenario for example with /d you’ll have more log and if you can check if there was any issue during the process.

 

 

I try to add more details in this post like import or export data to blob storage.