Dealing with SQL Azure Database

** Performing Backup to Azure **

1. Need a Storage Account at Azure.
2. In the storage, need a Container (kinda folder) for separating backup file for other files. 
	>> Container size can't exceed 1 TB.
3. Need Access Keys (can be copied from Manage Access Keys at Azure)
4. Define a "Credentials" under "Security". 
	>> Identity can be name of Storage Account and Password will be the access key.
5. In backup task, 
	>> choose "URL" as destination (Sample URL - https://mystorage.blob.core.windows.net)
	>> Provide backup file name
	>> choose "Credential" from available list. (refernce point 4)
	>> provide container name (refernce point 2)

	Note - Under Media Options >> Overwrite Media option and its suboptions are not supported when "URL" is a backup destination.
** Restoring Backup from Azure **

One Way - Download .bak from Azure store at local drive and restore it.

Another Way (Directly from Azure, Restore to create a new database)

1. Choose Device as a Source and click on Browse button
2. Select URL in the Backup Media Type and hit Add button
	>> Specify the Storage Account 
	>> Add the Access Key
	>> Select the existing credentials
	>> you will see the available containers for correct path of backup file.
3. Click Ok to start validation.
4. Once the file validated, then other restore options are made available to choose from.
5. Choose the appropriate option to finish the restore.

** Backup and Restore Azure SQL Databases via Management Portal **

Note - There is no option to take backup, configure SQL Jobs in Management Portal when dealing with Azure hosted DB's. 
So, creating a copy of DB is considered as "Backup". 

>> For Backup operation, connect to SQL Azure from your local Management Studio and execute the command 

1. Make a copy on same server in SQL Servers pool.

	>> Sample Command - Create Database SchoolCopy AS COPY OF MyAzure.School

2. Make a redundent copy on the different server in SQL Servers pool

	>> Export the database using (.bacpac) file
	>> Select the BLOB storage account
	>> Select the Container 
	>> Provide Login and password to create a deployable package.

	>> Select another server from Azure Server pool
	>> In Databases, choose (+ New) option from lower left corner (as Create a SQL database don't give import option)
	>> Data Services >> SQL Database >> Import (from BLOB storage account)
	>> Specify the URL for (.bacpac) file and click Open
	>> Select a server to import on.
	>> Provide Login and password to import the database.
Advertisements