Restore from Azure with LiteSpeed

Let's first destroy a little bit:

 And then let's ask our colleague to send us all the information about the Human Resources department :

Luckily us we just run a backup on Azure for this database. In this blog we will run the restore by Right clicking the backup we want to restore.
To do that we select the Database in the "Backup Manager" and then, on the right hand, we select the "Backup History" tab.
Then we select the backup to restore and we Right click on it.
Remember that we can also use the Restore option in the main menu instead (as we did in a previous blog ).

 

As you can see we jump directly to the "BackUp Files" section of the "Restore Wizard" and even there we have all the data populated:

 From now the wizard is exactly the same as if we were restoring from disk or Amazon. Anyway I will add the screens here for your reference.

 

As always we can see the script LiteSpeed will run by clicking on the "Preview Script" hyperlink.

In this case the script is:

---- Kill all current connections

DECLARE @cmdKill VARCHAR(50)

DECLARE killCursor CURSOR FOR
SELECT 'KILL ' + Convert(VARCHAR(5), p.spid)
FROM master.dbo.sysprocesses AS p
WHERE p.dbid = db_id('2AdventureWorks2012Dev')

OPEN killCursor
FETCH killCursor INTO @cmdKill

WHILE 0 = @@fetch_status
BEGIN
EXECUTE (@cmdKill)
FETCH killCursor INTO @cmdKill
END

CLOSE killCursor
DEALLOCATE killCursor

-----------------------

exec master.dbo.xp_restore_database @database = N'2AdventureWorks2012Dev' ,
@filename = N'lll\2AdventureWorks2012Dev_201707031330.bak',
@filenumber = 1,
@CloudVendor = N'AzureBlob',
@CloudBucketName = N'aatestcont1',
@CloudAccessKeyEnc = N'XZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZZZZZZ',
@CloudSecretKeyEnc = N'XZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZZZZZZXZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZZZZZZ',
@UseSSL = 1,
@with = N'REPLACE',
@with = N'STATS = 10',
@affinity = 0,
@logging = 0


GO

Hooray!!!! The database has been restored!

 Let's continue with our job now and get the information we need!

Hope this helps!

Anonymous