Saturday 17 September 2011

Import and Export (Backup and Restore) using Azure Management Portal


Backup and restore option was an important and useful option was missing with SQL Azure before. But this is now introduced as CTP with SQL Azure lab (it is also included with Azure Management portal).

Considering Backup and Restore functionality with SQL Azure, there are multiple ways available now. They are –
  1. Import and Export option provided with Management Portal
  2. Data-tire Application (DAC) framework APIs
  3. pcp utility
  4. Copy SQL Azure database to another database

Each method is useful for different situations. So having pros and cons of each method will be useful to decide which method to use.

This post explains Import and Export CTP option provided with Management Portal.

Understand the database to export
Below is the image show the database in SQL Azure and the aim is to take the backup of Northwind2 database using Azure Management Portal.
Export the Database
  1. Verify the database can be accessible from the system (by verify firewall configuration) and login with an user.
  2. Select the database under the server and press the Export button under the Import and Export CTP tab.
    Note: If the database not selected, the first database will be selected automatically.
  3. Once the database backup is completed, the backup file will be stored in Blob Storage service. The database backup file extension will be .bacpac.
    The system will popup Export Database to Storage Account.
    Provide the login details (Login, Password) and blob storage url and access key of the storage account. The Blob storage url will as http://storagename.blob.code.windows.net/containername/filename.bacpac. To enter the url, make sure you created a storage account and a container with storage account. Note the Access Key from the Management Portal for the storage account. The file name you can enter any name according to your standard
  4. Click the Finish button. Once the button clicked, it will show a popup informing the unique ID.
Know the Status of the Export and Import
  1. The status of the backup can known using the portal.To know the status, select the server and press the Status button under Import and Export CTP secion.
  2. It will open Import Export Request Status popup window. Provide Login Name and Password.
    Click Next.
  3. The screen shows list of request Id with the status on time.By clicking the Refresh button, it will refresh the status each Export and Import line.
  4. It will show the status of last two week Import and Export operations. Note:Sometime, the screen does not show all Export and Import operation status. Sometime it does not complete Export or Import also. Hope this will be corrected in release.

Check the database backup files in Blob
Below is the screen shot of blob service which contains the backup files exported from Management Portal. I use Azure MMC for getting the files from blob storage. The files can be downloaded by download BLOBs option.

Import the database
To import a database, the database backup file (.bacpac) must be in a blob storage.
  1. Select the Import button under Import and Export CTP.
  2. It will show a Import Database from Storage Account popup screen.
    Enter the Login details, the new database name, edition and size. Enter the Blob url where the bacpac file stored and Access Key.
  3. Press Finish. It will popup a window informing the request Id to know the status. The status of import operation can known at Status operation explained before.
  4. Below screen shows the imported database under the server.

As explained, each database can be backup by using Import and Export option provided. But it require some manual operation and it takes some space in the blob storage. So, it will be billed as per the space it takes. To reduce the cost, the exported files must be downloaded from blob storage, but this again will cost for transferring the data.

The database can be backup using DAC utility also and it can run in the local system. The backup files will be stored in the local system as well. To know how to use DAC framework, please verify the next post.

For automating SQL Azure backup using Worker Role, please look at another post Automating SQL Azure backup using Worker Role.

0 Responses to “Import and Export (Backup and Restore) using Azure Management Portal”

Post a Comment