Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

805


Chapter 31: Managing Data in Windows Azure SQL Database


31


Once connected to SQL Database, open a new query window and type the following:

CREATE DATABASE AWMini

For those of you who are somewhat new to SQL Database, you are probably looking at that
statement and thinking “There’s more to a create database statement than that!” Well,
in SQL Database, not really.

Truth be told, there can be more, but if you execute that statement as is against SQL
Database, it will work. I’ll briefl y explain. SQL Database abstracts the logical administration
from the physical administration. In SQL Database, you continue to administer databases,
logins, users, and roles, but Microsoft administers the physical aspects of SQL Database,
including hardware, hard drives, storage, etc.

Thus, when creating a database, Microsoft will determine the physical aspects of that data-
base, including its physical location in the Windows Azure data center you choose. As such,
your create database statement becomes much easier since you don’t need to specify all
the parameters of the create statement, such as drive and path.

There are two editions of SQL Database instances; Web and Business. Functionally, there are
no differences between them, but they do differ in the sizes you can select. When creating
a database in SQL Database, you need to specify the edition and size of the database. For
the Web edition, you can select 1GB and 5GB database sizes. For the Business edition, you
can select 10, 20, 30, 40, 50, 100, and 150GB sizes.

If you don’t specify an edition and size, a 1GB Web edition will be created. If you want a
50GB database, for example, your statement will look like this:

CREATE DATABASE AWMini (Edition= 'Business', MaxSize=50 GB)

A few words on cost and sizing. When you create a 50GB database, for example, you are paying for that 50GB,
regardless of whether you have 5GB or 40GB of data in the database. That is because when you create the
database, SQL Database allocates 50GB of space. You can programmatically change the size larger or smaller, but in
SQL Database, you pay for the size you specify.

One last note; unlike on-premises databases where you can specify auto-grow options, SQL
Database does not have this option. If you create a 50GB database and you fi ll it up, it will
not auto-grow to the next size. The database will go into read-only mode and reject all
inserts. Like I said, you can programmatically change the size via the alter database
statement, but you will need to monitor database growth, either manually or programmati-
cally, to prevent the database from fi lling up.

If you haven’t, execute the fi rst create database statement above to create your
database as we will be using it during the data migration section.

c31.indd 805c31.indd 805 7/31/2012 10:00:23 AM7/31/2012 10:00:23 AM


http://www.it-ebooks.info
Free download pdf