Daniel Wissa

Migrating a SQL database to SQL Azure

Continuing on with my previous posts on Windows Azure I thought I?d write up a post covering migrating a SQL Server database from a local SQL Server and into the cloud.

The conversion of a SQL Server database into SQL Azure for publishing in the cloud can be done by the SQL Azure Migration Wizard which you can find on CodePlex. For the purpose of this post I have decided to try and Migrate the AdventureWorks sample database into SQL Azure format.

Once you?ve installed the AdventureWorks databases from the link above when you logon to your local instance of SQL Server you should see the following databases listed.

Now your databases are ready and you can start the conversion wizard by running the SQL Azure Migration wizard executable which presents you with the following screen.

As you can see above the SQL Azure Migration wizard will allow you to migrate a T-SQL script file into the SQL Azure format as well as Migrate a SQL Server DB into the SQL Azure format. I have chosen the SQL DB option as shown below.

You are then prompted to enter the logon details for logging into the SQL Server instance that has the database to be migrated as shown below.

After choosing which database you wish to migrate you can then choose which database objects you want to migrate via the standard or advanced options as shown below.

For this post I?ve chosen the Script all database objects option. The following screen then shows a summary of the selection options chosen from the previous screens.

Then you are asked to confirm the generation of the script before proceeding.

Once the script is generated you will get the following screen showing a log of all actions of the script

You can then go ahead and execute this script on your SQL Azure instance as shown below.

Enter your azure DB connection details

Select the Database to execute the queries on or create a new database.

Run the script

Once the script has been completed you will see the following screen confirming the success/failure of the different operations that have been undertaken by the script.

Finally, you can then connect directly to your SQL Azure instance from SSMS to check the items generated by the migration as shown below.