What is BACPAC and how to use it?
In the previous blog, we discussed what is DACPAC and how to use it?
In this blog, we will discuss what is BACPAC and its uses.
What is BACPAC?
BACPAC contains database's schema and data.
It is the same as DACPAC but the only difference is BACPAC encapsulates data and schema whereas DACPAC only contains schema.
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. However, we cannot consider BACPAC as an option to database full backup.
There is a difference between BACPAC and .BAK file.
BACPAC file is small in size as compare to database backup file. This is because the BAK file contains logs records. Also, the BACPAC file cannot be applied on existing database.
The data in a BACPAC is stored in JSON format.
Let’s see how we can migrate the database using BACPAC package.
In this POC we have used database Transaction_DB. We got a requirement to migrate the database with schema + data to another instance. We will do this task using BACPAC data driven method.
Right-click
on database which Schema and data need to migrate.
Task-->Export Data-tier Application
We will get the Introduction page of Export Data-tier Application wizard.
Click on Next
We can also select the tables from which data need to be exported. Click on the Advanced tab on the same page for the same. By default, all tables are selected.
Select the destination for BACPAC file and Click on Next
On the next page, review the summary of the task and Click on Next.
On the final window, we can see the result of the task.
Now we have
exported BACPAC file lets import the same on the target instance.
Connect to
Target Instance and follow the below steps.
Right-click on Databases-->Import Data-tier Application
This will
open introduction page of Import Data-tier Application wizard
Click on Next
On next
window, we have to specify the BACPAC package which we have to import.
Browse and Select BACPAC package and Click on Next
On next window, specify Database name and path for data and log file.Click on Next.
Note: As mentioned before, the BACPAC package can not be applied on existing database.
Verify the task on the summary page and click on Next.
We can review operation completion status on the final window.
After successful
completion of the task, we can see the database is restored on target Instance.
Thank you.
Thanks for this blog its really helpful👍
ReplyDeleteGood to know this feature 👍
ReplyDelete