Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are Azure BACPAC backup files different than SQL Server BAK files?

Are BACPAC and BAK files conceptually the same thing? A single, self contained file in which you can use to backup/restore a database?

like image 832
WhiskerBiscuit Avatar asked Sep 14 '16 06:09

WhiskerBiscuit


People also ask

What is the difference between Bacpac and BAK file?

Bak files are snapshots of entire Database as it existed at a point in time and Bacpac files are snapshots of how the Database existed over the period of time while the backup was made.

What is Bacpac file 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 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.


1 Answers

BACPAC files are not transactionally consistent and that can lead to a database where data is not consistent across tables. Here's what I mean by this: if you start the process of creating a BACPAC and while that's going some data gets updated in the source database then the BACPAC file could contain data from table A as it was at 1:00 PM and also data from table X as it was at 1:03 PM ... but if table A was also updated at 1:03 PM that change may not exist in the BACPAC file if table A's data was exported at 1:00 PM by the export process.

It's important to create BACPAC exports from data sources where there is no write activity while the export executes.

In Azure SQL Database for example the best practice is to first create a copy of the database in question and then run the export to BACPAC on the copy (not on the original source db). Creating a copy of the database is transactionally consistent whereas the export to BACPAC is not.

like image 52
Cristian Satnic Avatar answered Nov 15 '22 21:11

Cristian Satnic