Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bacpac vs dacpac for migrating database to Azure

I am deploying a large database (both schema and data) from an on-premise server to Azure SQL. I plan on using sqlpackage.exe from the command line. It looks like there are two options:

  1. Extract a DACPAC and then publish it to Azure, using the ExtractAllTableData option to include data in the extraction
  2. Export a BACPAC and then import it to Azure

Is there a preferred option? I need this process to run in the fastest way possible, so I'd be curious if one option is better for performance.

like image 703
wooters Avatar asked Jan 02 '18 23:01

wooters


People also ask

What is difference between Bacpac and Dacpac?

A DAC is a logical database management entity that defines all of the SQL Server objects which associates with a user's database. A BACPAC includes the database schema as well as the data stored in the database.

What is Bacpac in Azure?

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, Azure SQL Managed Instance, or a SQL Server instance.

What is the use of Dacpac file?

The . dacpac can be used to update a database with new or modified objects, to revert to a previous version of the database, or to provision an entirely new database. Conversely, a . dacpac can be generated from an existing database and used to establish a SQL database project based on the current database schema.


Video Answer


1 Answers

As Grant said bacpac is dacpac+data.Below is one more definition that might help

"A bacpac includes the schema and data from the database. A dacpac containers only the schema and not the data"

You might have understood, you need bacpac.

I need this process to run in the fastest way possible, so I'd be curious if one option is better for performance.

We have few databases(400Gb) in Azure.we observed it is faster to import data when we load data from storage..The approach we followed was to load data into storage which is in same location as database and then import data..

SQLSERVER team tested a few options and they observed BCP is fastest compared to remaining options..

enter image description here

Below is how you import bcp data into azure

bcp TestDB.dbo.Customer in "C:\Users\cesardl\BCP\Customer.txt"
-c -U mysqlazureuser@mysqlazureservername
-S tcp:mysqlazureservername.database.windows.net
-P mypassword

Further reading/References:

Importing/Exporting data to SQL Azure databases using BCP and SQL Scripts
Loading data to SQL Azure the fast way

like image 82
TheGameiswar Avatar answered Nov 03 '22 21:11

TheGameiswar