Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

How to Migrate SQL Database to Azure SQL Database using SSMS Export/Import

5.00/5 (4 votes)
19 Nov 2018CPOL4 min read 10K  
Migrating SQL Database to Azure SQL Database using SSMS Export/Import Contents

How to migrate SQL Database to Azure SQL Database using SSMS Export/Import

How to migrate SQL Database to Azure SQL Database using SSMS Export/Import

Contents

  • Introduction
  • Creating the .bacpac file using SSMS Export
  • Importing the .bacpac file using SSMS Import
  • Summary

Introduction

There are many ways of migrating the On premise SQL Database to Azure SQL Database. In the previous article on migrating SQL Database to Azure SQL Database, we discuss the SSMS deploy method as a step by step process. This article will tell how to migrate SQL Database to Azure SQL Database using SSMS Export/Import data as a step by step process. It is a multi steps process where in the first step, we need to export the data into a BACPAC (.bacpac) and then in the next step, import that BACPAC file. It means even if the import data step is failed, we don’t need to repeat the data export process again. As we have the exported BACPAC file, we just need to restart the Import process. This process requires longer downtime. So this process is suitable for larger databases if the downtime duration is acceptable.

Migrating SQL Database to Azure SQL Database using SSMS Export Data

Creating the .bacpac File using SSMS Export

As a first step, we need to create the .bacpac file of the On premise SQL database which we want to migrate to the Azure SQL Server. So connect to the On premise database server and select the SQL database to migrate. Right click on it and select the option Export Data-tier Application.. (as shown in the below screenshot):

Select the database for migrating to Azure

Select the database for migrating to Azure

Once the option Export Data-tier Application.. clicked, it will open the Export Data-Tier Application page as shown in the below screenshot.

Introduction Screen for Data export

Introduction Screen for Data export

Click on Next button to reach the Export Setting screen. In this screen, we need to select the location for storing the .bacpac file.

Select the .bacpac file location

Select the export (.bacpac) file location

Click on the Next button to reach the Summary Page. In this screen, we need to recheck the setting which we have specified.

Verify the specified settings

Verify the specified settings

After verifying the specified settings, click on the Finish button. It will start the process of .bacpac file creation as shown below:

Processing the creation of .bacpac file

Processing the creation of .bacpac file

Once this operation got completed, the below screen comes. Click on the Close button. This will complete the database export part of this migration process.

Operation Completion Screen

Operation Completion Screen

Importing the .bacpac File using SSMS Import

After creating the .bacpac file by exporting the data, we need to import it into the Azure SQL Database. For this, first connect with the Azure SQL Server through SSMS. Then, right-click on the Databases node and choose Import Data-Tier Application..

Choose Import Data-Tier Application

Choose Import Data-Tier Application..

It will open the below Import Data-Tier Application.. page as shown below:

Import Data-Tier Application..

Import Data-Tier Application..

Click Next button. It will open the Import Settings page. In this page, we need to specify the .bacpac file location for import.

Specify the BACPAC file for import

Specify the BACPAC file for import

Click Next to reach database setting page. Here, we need to specify the Azure SQL Server Name, New Azure SQL Database name & the service tier based on the database size and other requirement as shown in the below screenshot:

Database setting page
Database setting page

We can change the default Microsoft Azure SQL Database settings as per your requirement. For example, I have changed the Edition of Microsoft Azure SQL Database, Maximum database size (GB) and Service Objective for my database as shown in the below screenshot.

Change Azure SQL Database default settings

Change Azure SQL Database default settings

Once all database settings have been defined, click on the Next button. It will bring up the Summary page as shown below:

Summary Page for verify settings

Summary Page for verify settings

Once settings have been verified, click on the Finish Button. It will start the Import process as shown in the below screenshot:

Importing Database...

Importing Database…

Once the Importing database process completed successfully, it will bring up the Result page. Click on the Close button.

Result Page - Importing Database process successfully completed

Result Page – Importing Database process successfully completed

Database is successfully imported to the Azure SQL Database. We can it verify by connecting the Azure SQL Database using the SQL Server Management Studio and then expanding the Database node. Database will be visible and it is available for SQL queries as shown in the below screenshot.

Executing SQL Query against the imported database

Executing SQL Query against the imported database

Summary

This article is part of the series "Migrating SQL databases to Azure SQL Database". In the last article in this series, we discussed SSMS deploy method for migrating the SQL Database to Azure. In this article, we discussed how to migrate SQL Database to Azure SQL Database using SSMS Export/Import data as a step by step process. Unlike SSMS deploy method, which is a single step process and suitable for smaller databases, it is a multi step process and suitable for large databases but with longer downtime required. In the next article, we are going to discuss the migration of SQL database to Azure SQL Database using the Microsoft database migration assistant (DMA) tool.

Please don’t forget to give your valuable comments for the article.

License

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