Would you like to move SQL Server databases out of your datacenter and into a reliable, scalable, and secure solution? How about taking those databases that are rarely accessed or even idle and storing them somewhere else?
Windows Azure SQL Database can help you with solve those issues and more!
What is Windows Azure SQL Database?
Windows Azure SQL Database is a feature-rich, fully managed relational database service that offers a highly productive experience, incorporates proven SQL Server technology, and delivers business-class capabilities.
SQL Database allows customers to scale business apps for burst and global reach by removing the high costs of building an infrastructure which would accommodate occasional peak loads. Customers can also remove the security risks and hassles associated with hosting public-facing apps & websites from within a datacenter by quickly & cost-effectively building websites and mobile & social apps directly on SQL Database. Finally, customers with strict data policies can get the best of both worlds by keeping sensitive, policy-constrained data on-premises while extending parts of their application to the cloud for added innovation, scale and agility.
Let’s take a look at SQL server in Windows Azure and walk through how to upload a Windows SQL database into a Windows Azure SQL Database.
- SQL Server Management Studio 2012 (connecting to SQL Server instances)
- Export from SQL 2000 Database Server and up
To work with a DAC BACPAC, you must have installed the client DAC software, known as the DAC Framework. The DAC Framework is included with SQL Server Data Tools and the SQL Server utilities such as SQL Server Management Studio. When working with SQL Database, the recommended version of the DAC Framework to use is the one included in SQL Server Data Tools and SQL Server 2012. You can also upgrade earlier versions of the DAC framework by installing these three packages from the SQL Server 2012 Feature Pack:
- Microsoft System CLR Types for Microsoft SQL Server 2012
- Microsoft SQL Server 2012 Transact-SQL Script DOM
- Microsoft SQL Server 2012 Data-tier Application Framework
For information about compatibility between versions of the DAC Framework and versions of SQL Server, see DAC Support For SQL Server Objects and Versions.
EXPORT A WINDOWS SQL DATABASE TO WINDOWS AZURE SQL DATABASE
In the Microsoft SQL Server 2012 Management Studio select and right click on the database you’d like to export:
Select “Tasks” the select “Deploy Database to SQL Azure…”
Click next on the Welcome screen
On the Export Settings screen there are two options: Save to disk or save to a Windows Azure storage account (i.e. blob). For this walk-through I will choose “Save to Windows Azure” and select “Connect…”
Note: If you chose to save to a local drive you’ll need to upload the .bacpac file to a Windows Azure storage account manually. For more information on how to upload data to Windows Azure please read my post on Windows Azure Storage there are a couple of free tools toward the bottom of the post that allow uploading data to Windows Azure fast and easy.
After selecting “Connect…” you’ll need to populate some fields.
· Storage account: the name of your Windows Azure Storage Account.
· Account key: the access key associated with the Window Azure Storage Account.
LOCATING THE “STORAGE ACCOUNT” NAME AND “ACCOUNT KEY”
1. Navigate to http://manage.windowsazure.com/ and either log into your account or sign up for a trial account.
Note: If you’re new to Windows Azure and sign up for a trial account you’ll need to set up a storage account. Instructions may be found here: http://www.windowsazure.com/en-us/manage/services/storage/how-to-create-a-storage-account/
2. Once you’re logged into Windows Azure you’ll see a variety of options on the left hand navigation. Go ahead and select “STORAGE” from the list:
3. Select a storage account and then select “MANAGE ACCESS KEYS” at the bottom of the page:
4. You will see the following:
5. Copy and paste the STORAGE ACCOUNT NAME and PRIMARY ACCESS KEY from the Manage Access Keys page into the open fields and select “Connect”:
6. Once you’re connected to a Windows Azure storage account select a container and select “Next”:
7. Review the summary information and select “Finish”:
Once the export is complete review the summary of export tasks and select “Close”:
Congratulations, you’ve exported a database (.bacpac) from your SQL Server into a Windows Azure Storage account.
IMPORTING A .bacpac INTO A WINDOWS AZURE SQL DATABASE
First, let’s make sure the upload from the previous steps succeeded.
I’m using CloudXplorer to view my storage account:
Now that I verified the .bacpac was uploaded, let’s import the database into a Windows Azure SQL Database:
Navigate to http://manage.windowsazure.com/ and either log into your account.
Once you’re logged into Windows Azure you’ll see a variety of options on the left hand navigation. Go ahead and select SQL DATABASES from the list:
Select the “IMPORT” at the bottom of the page:
Select the .bacpac file from your storage account:
Navigate the storage account folder structure and select the .bacpac you uploaded in previous steps:
· Type in a “NAME” or keep the default
· Select an existing “SERVER” or elect to create a new SQL database server.
· Fill in the login information
· Check the “CONFIGURE ADVANCED DATABASE SETTINGS” check box
On the “Advanced database settings” page there are two database options:
1. WEB: where you have database size limits of 1 GB and 5 GB
2. BUSINESS: where you have database size limits ranging from 10 GB – 150 GB
I selected WEB 1 GB option. However you’ll need to size your database accordingly.
Note: if you need to expand the size of a database you can do this using the SCALE option in the Windows Azure database management portal.
Take a look at the status of the import at the bottom of the page:
The database will show up in your database list:
Select the database to view more information about it:
Congratulations, you’ve exported a SQL database from your SQL Server and imported it into Windows Azure!
Did you know you can export a SQL database from Windows Azure SQL as well? It’s available at the bottom of the Windows Azure SQL Database page.
Here’s another tool that exports SQL Server databases and imports into Windows Azure SQL: http://sqlazuremw.codeplex.com/