In this blog we will try to restore the database that we backup to a Windows Azure Storage in the previous blog. Let us first check the backup blobs we have created in the previous blog
We have several blobs in the storage created by our smart backup and we could also check that from our SSMS by click on connect then enter
Then we enter the storage account name and account key we created here.
We could see the same blob list we have seen on the management portal.
Before we started our backup process I could not find a wizard indicated on SQL Server 2014 CTP1 White Paper named (SQL Server 2014 Platform for Hybrid Cloud Level 300, Page 9). Since I don’t have permission for the image and it is a pdf file and I can’t actually create web link to display it here I will show you what they have there.
After opening the traditional restore wizard they selected Device then on the Backup Media type they have Additional option for URL but I could not find any option other than File in SQL Server CTP1. Then I have to try restoring the blobs using a script
To do that let us first drop our existing database from Windows Azure VM
--drop the existing database-- EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'sql2014DB'; GO USE master; GO ALTER DATABASE sql2014DB SET; SINGLE_USER WITH ROLLBACK IMMEDIATE; GO DROP DATABASE sql2014DB; GO
Then I wrote this script for the restore
--Restore the last good backup blob USE master RESTORE DATABASE sql2014DB FROM URL = N'http://dbandbi.blob.core.windows.net/backup/dbandbivm-mssqlserver/sql2014DB_f2641c0246e94b65ad36ddce2d831330_NULL_20130927081821+00.bak' WITH FILE = 1, NOUNLOAD, STATS = 5, CREDENTIAL = 'AzureCredential'; --Check the previous blogs how we created this credential go
Okay now let us verify if we actually restored our database from Windows Azure Storage backup blob to our SQL Server 2014 on Windows Azure virtual machine.
Great we manage to restore our database using script indeed.
Thanks for reading. Subscribe and leave a comment if you have one.