3. Managing a SQL Azure Database
At this point, we could continue using the
Management Portal to create our database, but we can also use SQL Server
Management Studio. To connect to our SQL Azure Server, we simply put
the fully qualified DNS name in the connection string, as shown in Figure 6.
Figure 6. Connection dialog of SQL Server Management Studio
Provided your local IP is within the firewall
and you supplied the right login and password, you should see the
familiar Object Explorer enumerated with various database-level objects.
Note that SQL Azure only supports SQL Authentication at this time. One
of the things you will notice after a successful connection is the
Object Explorer tree does not contain a lot of the nodes it contains
when connected to on-premise SQL Server. This is because a SQL Azure
database is not the same as an on-premise SQL Server. When you connect
to a specific SQL Azure Server, you will see all your databases within
that server. From a physical perspective, this is a façade, because in
reality, these databases are physically spread across the environment to
various nodes. Each node services many databases, so it is unlikely
that any of your databases are on the same physical server. This
architecture allows for SQL Azure to load balance and automatically move
databases within the cluster and to take advantage of the available
capacity and to maintain the published service level agreement (SLA).
Note
Currently Microsoft provides a 99.9% SLA per month for the SQL Azure
platform. More information about SLA can be viewed in the following web
site: www.microsoft.com/windowsazure/sla
.
With Microsoft taking care of the physical
placement of the database, you won’t find any stored procedures that
deal with the file system. Some other objects you may notice missing are
SQL Server Agent. There is no job scheduling service available in SQL
Azure at the time of this writing. A workaround would be to leverage a
Windows Azure Compute node or an on-premise SQL Server Agent that would
make a call to the SQL Azure database. Connecting to a SQL Azure
database via SQL Server Management Studio yields the Object Explorer
tree shown in Figure 7.
Figure 7. Object Explorer connected to a SQL Azure database
You’ll notice in Figure 7
that the build number for SQL Azure is different from that of the
current SQL Server releases. SQL Server 2008 starts with 10.00 and SQL
Server 2008 R2 starts with 10.5. Currently in SQL Azure, the build is
10.25. SQL Azure updates on its own schedule about every 3–6 months, so
the version numbers will always be different than what you will find on
an on-premise SQL Server installation
From SSMS, we can create a
new database by selecting Create Database from the context menu of the
Databases node or by using the CREATE DATABASE
command
within a New Query window. While the amount and quality of dialogs may
be increased in later versions of SQL Server, the Create Database
context menu item simply puts a template script in the Query Editor
window. To create a database, let’s issue the following command in the
query editor window:
CREATE DATABASE MyTestDB
Upon a refresh of the Object Explorer, we can see the newly created database.