A data-tier application (DAC) is a logical database entity that defines all of the SQL Server objects - such as tables, views, and instance objects, including logins - associated with a user's database. A data-tier application is a self-contained unit of the entire database model and is portable in both .dacpac and .bacpac packages. Tooling support for data-tier applications enable developers and database administrators to apply .dacpac and .bacpac files to new or existing databases or generate new files from existing databases.
Operations
BACPAC operations
The .bacpac file format is a related artifact that by default encapsulates the database schema and the data stored in the database. Objects in the .bacpac database model are limited to the surface area of Azure SQL Database. The primary use case for a .bacpac is to move a database from one server to another - or to migrate a database from a local server to the cloud - and archiving an existing database in an open format.
The .dacpac data-tier application package is the build artifact from SQL database projects and can be used as part of a comprehensive database lifecycle management and DevOps strategy. Data isn't included in a .dacpac by default, but you can choose to include data from user tables when you extract a .dacpac from a live SQL Server or Azure SQL Database. As an integral part of the SQL database project workflow and database development lifecycle, .dacpac files are used in several operations. The primary operations are:
Deploy/Publish - the user can deploy a .dacpac to a host server. When the deployment is done to an existing database, the difference between the database and the DAC is dynamically calculated and applied as an incremental update. The term "publish" is often used interchangeably with "deploy." For more information, see SqlPackage publish and Deploy a Data-tier Application.
These capabilities can be found in the SqlPackage CLI, SQL Server Management Studio, Azure Data Studio, and SQL Server Data Tools.
In addition to publish and extract, you can also track the database model in the system metadata by utilizing the dac registration functionality:
Register - the user can register a database as a data-tier application. Register stores a representation of the current state of the database schema in system metadata.
Unregister - a database previously registered as a DAC can be unregistered.
Upgrade - a database can be upgraded using a .dacpac.
Data-tier application tools
Tooling support for data-tier applications enables developers and database administrators to work with .dacpac and .bacpac files from both graphical and command line interfaces. In addition to released tools, data-tier application APIs are available in the Data-tier Application Framework (DACFx) for .NET development and database lifecycle customization.
DACPAC and BACPAC packages
The following tools support the .dacpac and .bacpac formats:
In these tools, a database can be extracted to a .dacpac or exported to a .bacpac. Conversely, a .bacpac can be imported into a new database or a .dacpac can be published to a new or existing database.
DACPAC and SQL projects
The following tools support the .dacpac file format in addition to providing editing of SQL database projects:
Learn how to create and configure an Azure SQL Database. You'll use SQL Database Projects in VS Code, including installing the extension, importing, and modifying a schema. Additionally, you'll build and deploy database projects in GitHub Actions and Azure Pipelines, and automate and invoke the publishing of a database.
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.