Migrate an On-Premises SQL Server 2012 Database to Windows Azure SQL Database – Part 2

Export – Import Data-tier Application 

Exporting a deployed data-tier application (DAC) or database creates an export file that includes both the definitions of the objects in the database and all of the data contained in the tables. The export file can then be imported to another instance of the Database Engine, or to Azure SQL Database. The export-import operations can be combined to migrate a DAC between instances, to create an archive, or to create an on-premise copy of a database deployed in SQL Database.

The export process builds a DAC export file in two stages.

  1. The export builds a DAC definition in the export file – BACPAC file – in the same way a DAC extract builds a DAC definition in a DAC package file. The exported DAC definition includes all of the objects in the current database. If the export process is run against a database that was originally deployed from a DAC, and changes were made directly to the database after deployment, the exported definition matches the object set in the database, not what was defined in the original DAC.
  2. The export bulk copies out the data from all of the tables in the database and incorporates the data into the export file.

A DAC or database can only be exported from a database in SQL Database, or SQL Server 2005 Service Pack 4 (SP4) or later.

You cannot export a database that has objects that are not supported in a DAC, or contained users. For more information about the types of objects supported in a DAC

 

Open SSMS On-Premises and Right click on the database

MAzureDAC1

MAzureDAC2

You can save the BacPac file to On-Premises disk or to Azure Storage

MAzureDAC3

I have saved the file locally, you can choose to export all the table schema and object or you can select the one you want to export

MAzureDAC5

MAzureDAC4

Connect to Azure SQL Database from On-Premises SQL Management Studio

 

MAzureDAC6

Right Click the Database Folder and select Import Data-tier Application

MAzureDAC8

MAzureDAC9

 

MAzureDAC10

MAzureDAC11

Connect to Azure Account , provide the database name and choose from the Azure Database Settings

MAzureDAC12

MAzureDAC13

MAzureDAC14

MAzureDAC15

After the Successful import , you can see the database in Object Explorer.In case you get an error , you have to rectify the error by creating a new bacpac file and try to import again. To read on how to Import a BacPack file explore https://msdn.microsoft.com/en-us/library/hh710052.aspx

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *