Click here to Skip to main content
14,971,029 members
Articles / Database Development
Tip/Trick
Posted 6 Apr 2021

Stats

1.6K views
2 bookmarked

Import or Restore BACPAC File using SQL Server Management Studio

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
6 Apr 2021CPOL3 min read
How to import or restore BACPAC file using SSMS
This post describes how to import or restore BACPAC file using SQL Server Management Studio. It helps developer and database administrator to create database from one environment to another by using SSMS and importing database BACPAC file.

Introduction

Backup package (BACPAC) contains schema and data for SQL Server database. We can export the database into BACPAC and import it in a new environment as a new database. This can be used as per our convenience to migrate data from one environment to another or one SQL Version to another. This restore option has become the best choice for Database Administrator and developer for migration or restore database for various purposes. This article describes how to import BACPAC file using SQL Server Management Studio. In this example, I have used SQL Server 2019 Developer edition and I would recommend to use the latest version of SQL. Let us go to import options. In the example, I will use the already created BACPAC file. If you don’t have file and need assistance to create BACPAC file, you can go through my previous article on How to Export BACPAC.

Steps to Import/Restore BACPAC File

Step 1

Open SQL Server Management Studio, connect to SQL instances where you want to restore database and right click on Database. Then you will get an option as shown in the below picture. Click on Import Data-tier Application.

Image 1

Step 2

You will get the below window. Click on Next as illustrated in the below picture:

Image 2

Step 3

Then, you will get an option to import backpack file either from Local disk or from Windows Azure. As I am explaining the steps to import backpack file from local storage file, we will select Import from Local disk option and browse the file in this step.

Image 3

However, we can connect to Azure Storage account and import file from Storage account and create new database with that file.

Image 4

To import from Windows Azure, once we click connect Option, we have to Sign in with Azure account and select the Storage Account, Blob container and click on OK.

Image 5

As the focus of the article is to import from local disk, let’s continue with Local file import steps.

Import the file from local Disk and click on Next.

Image 6

Step 4

Give the name of your Database and click on Next. You can keep the default file path for the Data and Log. However, you can change, file path for Data and Log.

Image 7

Step 5

In this step, detailed summary of your previous selections will be seen as depicted below. Click on Finish to proceed further.

Image 8

Step 6

Once you click on Finish, it starts creating database, based on your BACPAC file.

Image 9

It may take few minutes to create database, tables, stored procedure, Views, etc. and import data to the tables. Wait for the process to complete.

Image 10

Once it is completed, you can see what are the tables, store procedures, views so on created on the result windows as well as you will get option Close, click on Close.

Now, database is created using BACPAC file. You can check and verify your database. It is ready to use as per your requirement.

Conclusion

In short, this tip has described how to create database using BACPAC file. I hope that this post will help developers and database administrators to create a database from one environment to another by using SSMS and importing database BACPAC file.

History

  • 6th April, 2021: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


Comments and Discussions

 
-- There are no messages in this forum --