Previous Posts that you should review

bullet

Step 1
hyperlink[6]

http://blogs.msdn.com/b/brunoterkaly/archive/2010/06/12/creating-an-on-premise-database-and-mvc-web-application-and-migrating-to-windows-azure-and-sql-azure-step-1-of-10.aspx

bullet

Step 2
hyperlink[6]

http://blogs.msdn.com/b/brunoterkaly/archive/2010/06/11/creating-an-on-premise-database-and-mvc-web-application-and-migrating-to-windows-azure-and-sql-azure.aspx

bullet

Step 3
hyperlink[6]

http://blogs.msdn.com/b/brunoterkaly/archive/2010/06/27/creating-an-on-premise-database-and-mvc-web-application-and-migrating-to-windows-azure-and-sql-azure-step-3-of-10.aspx

bullet

Step 4
hyperlink

http://blogs.msdn.com/b/brunoterkaly/archive/2010/06/28/creating-an-on-premise-database-and-mvc-web-application-and-migrating-to-windows-azure-and-sql-azure-step-4-of-10.aspx

 

Introduction

SQL Azure
We will migrate our database to SQL Azure in this post. There are many reasons why SQL Azure is a good idea.

bullet

Microsoft® SQL Azure™ (formerly SQL Server Data Services and later SQL Services) Database is a cloud-based relational database service built on Microsoft SQL Server® technologies

bullet

It provides a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud

bullet

SQL Azure Database helps to ease provisioning and deployment of multiple databases. Developers do not have to install, setup, patch or manage any software

bullet

High availability and fault tolerance is built-in and no physical administration is required. SQL Azure Database supports Transact-SQL (T-SQL). Customers can use existing knowledge in T-SQL development and a familiar relational data model for symmetry with existing on-premises databases

 

 

Navigate to http://sql.azure.com

The portal
The SQL Azure Portal allows you to manage your database. Note that the server name of my particular database is bjzkzsxp9c.database.windows.net. Your database will have it’s own address.

snap0093

 

The ‘master’ database is always there 

stocksdb was created by click on ‘Create Database’
Before you can move your data from on-premise to SQL Azure, you will need to have a database ready to accept the data.
snap0094

 

‘Create Database’ can be used 

Options for a business user
MyImage 

Notice that the business edition gives you several options in terms of the ‘size’ of the database you want.
snap0095

 

Take note of the server name

Needed in connection string
In the next blog post we will need to adjust our connection string so that our data comes from SQL Azure.

bullet

bjzkzswxp9c.database.windows.net is the name of our server. Yours will be different.
snap0096

 

SQL Azure Migration Wizard

Found at CodePlex
The URL is http://sqlazuremw.codeplex.com
snap0097

 

Analyze and Migrate 

Migrating the SQL Database
Select SQL Databaes below.
snap0098

 

The ‘source’ of our data

localhost
localhost is the local ‘on-premise’ version of our database. We are selecting the data that we want to copy to SQL Azure.
snap0099

 

Choose the data that you want to migrate

The data is moving to the cloud
By selecting StocksDatabaseOnPremiseDb we are identifying the database that we wish to push to the cloud.
snap0100

 

Narrowing down the data to migrate 

You don’t need to migrate ALL the data
In this case, we only have one table and a stored procedures that we wish to migrate. We are choosing ‘Script all database objects.’
snap0101

 

Generating the SQL Script

Purpose of script
The SQL script that we generate will be used to migrate data. Clicking ‘Yes’ followed by ‘Next’ will take us to the next step. We will need to select a target database shortly.
snap0102 snap0103

 

Connecting to SQL Azure

Verify your Server Name
At this stage we wish to identify where we want to put our data. We have already identified the source. Now we need to identify the target. This is where you type in the server name that you got from the SQL Azure Portal.

image 

 

Choosing the target database

StocksDB
Previously, when we were at the portal, we created a database called ‘stocksdb’

It is a simple case of going to the AQL Azure portal and clicking ‘Create Database’ and then giving the database a name of ‘stocksdb’

image snap0106 snap0107

snap0108

 

Using SQL Server 2008 R2 Management Studio 

Verifying our data migrated successfully
The good news is that SQL Server Management Studio can be used with SQL Azure. This is a big deal and many of my audiences loved that this is true.
snap0109

 

New Query Editor Window 

Right click on dbo.Stocks
We will just illustrate a ‘select’ statement.

snap0110 snap0112

We have completed this post.

Future Posts

MVC App still needs to be put in the cloud
We have succeeded in putting the data in the cloud, but our application (MVC Web App) still needs to be migrated. that is the subject of future posts.