Tonight I’m starting a new project. Porting to the cloud a real application running “on premises”.
The first step of this migration is the database. For the moment I want just to recreate the database schema. The data migration will be done in the future but since I hope the database schema will be the same I believe this step will be an easy task.
I have already setup my SqlAzure credential (there are many posts about it). If you want to connect using SSMS (SQL Server Managment Studio) this are the step you need to follow:
- Cancel the first connection dialog that pops up when you open SSMS.
- Click on the New Query button from the toolbar
- Enter your server name: eg. xxxyyyzzz.database.windows.net
- Enter your Login: username@xxxyyyzzz
- Hit connect.
This is my login prompt:
If you get this error: “Invalid object name ‘sys.configurations’” it’s because you didn’t cancel the first logon prompt.
Once you logged on you are ready to go. In my case I have 2 scripts: one for database creation and one for the creation of the database’s objects (tables & indexes).
The first it’s very very simple. Just the common CREATE DATABASE statement in order to create the db. No problem with that.
Now my database is up & running. I need a new connection to run the second script. It this connection I must set the database name in the options as shown below:
Unfortunately with the second I get some errors at the first run cause I’m using some SqlServer features that are not available on SqlAzure. Using the “Parse” button several times I can detect which features are not supported and than correct my script.
At the end my script pass and my database is ready to use.
In the next post I’ll try to migrate the web application (which is built with ASP.NET MVC V1)