Course Title



Fast Start for Microsoft Azure - SQL Server IaaS Workshop Lesson 4 Migrate SQL Server to Azure VMDemo Manual Instructor Edition (Book Title Hidden Style)Conditions and Terms of UseThe contents of this package are for informational and training purposes only and are provided "as is" without warranty of any kind, whether express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, and non-infringement.Training package content, including URLs and other Internet Web site references, is subject to change without notice. Because Microsoft must respond to changing market conditions, the content should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. ? 2015 Microsoft Corporation. All rights reserved.Copyright and Trademarks? 2015 Microsoft Corporation. All rights reserved.Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual plying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. For more information, see Use of Microsoft Copyrighted Content at?, Internet Explorer?, and Windows? are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other Microsoft products mentioned herein may be either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are property of their respective owners.Contents TOC \o "1-3" \h \z \u Demo 1: Migrating SQL Server to Azure VM using deployment wizard PAGEREF _Toc464228514 \h 6Exercise 1: Migrate SQL Server database to virtual machine in Azure by performing on-premises backup using compression, manually copying and then restoring the backup file into the Azure VM PAGEREF _Toc464228515 \h 6Demo 1: Migrating SQL Server to Azure VM using deployment wizardIntroduction This demo provides guidance on how to migrate a SQL Server database to a virtual machine in Azure. This is one of the fastest and simplest method to do the migration and is the recommended method if feasible with your requirements of database size and version of SQL Server.Objectives After completing this demo, you will be able to:Migrate a SQL Server database from on-premises to virtual machine in AzureScenario As you learnt in the lesson, there are various ways to migrate a database from on-premises to Azure VM. Which method you choose will depend on the size of the database and other factors such as network reliability and network speed. Generally, Backup to URL and Restore from URL is one of the easier methods to migrate a database. There is a lesson devoted to this topic in the next module along with a demonstration so in order to avoid repetition we won’t go in detail of that method in this demonstration. In this demo, we will perform on-premises backup using compression, manually copy the backup file into blob storage and then restore the database in Azure VM from that file.Exercise 1: Migrate SQL Server database to virtual machine in Azure by performing on-premises backup using compression, manually copying and then restoring the backup file into the Azure VMObjectives Use the Deploy a SQL Server Database to a Microsoft Azure VM wizard in Microsoft SQL Server Management Studio to migrate a SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, or SQL Server 2016 on-premises user database (up to 1 TB) to SQL Server 2014 or SQL Server 2016 in an Azure virtual machine. When you migrate a database to a newer version of SQL Server, the database is automatically upgraded during the process.Take a compressed backup of your on-premises database, as shown belowBACKUP DATABASE [TestBackupDB] TO DISK = N'D:\ SQL\ Azure\MyDB3.bak' WITH INIT , NOUNLOAD , NAME = N'MyDB backup', STATS = 10, FORMAT, COMPRESSION,BLOCKSIZE = 65536P.S. If you are taking backup on your local desktop you might have to set the block size so that it matches on a VM in Azure and restoring completes without any issue.Copy this backup from the above path to blob storage. This step can be performed in various ways. One of the easiest ways is to use one of the third party storage tools for Azure such as CloudXplorer () and paste the backup file in the blob storage as shown below (make sure you choose upload as page blob) so that the file can be used for restoring easily.Or if you wanted to script out the upload operation to blob store, you can use command line tool azcopy to perform the upload. After you download the azcopy tool then you can run the following script to perform the upload$azPath = “C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy”Set-Location $azPath$StorageAccountName = “sqlresource3364” #Insert your storage account key here$StorageAccountKey = “xxxxxxx$ContainerName = “backup”$SourceFolder = “D:\SQL\Azure”#This is the destination container in the blob storage where backup file will be uploaded$DestURL = ““#Syntax for pasting the file from sourcefolder to the destination container as a page blob$Result = .\AzCopy.exe /Source:$SourceFolder /Dest:$DestURL /BlobType:page /destkey:$StorageAccountKey $Result Now restore the database on an Azure VM using this file. Use the Azure VM with SQL Server which you provisioned in the previous demo as shown below:RESTORE DATABASE [MyTestDB] FROM URL = N''WITH CREDENTIAL = N'AzureCredential',MOVE 'TestBackupDB' to 'F:\DATA\Mydb.mdf',MOVE 'TestBackupDB_log' TO 'F:\Log\Mydb_log.ldf'GOThe credential called Azure Credential can be created using following syntax:USE masterGOCREATE CREDENTIAL [AzureCredential]WITH IDENTITY ='sqlresource3364' --storageaccname,SECRET = 'xxxx' --key for storage accountGOFollowing these steps, you have a database migrated to VM in Azure. In the next module you will see migrating a database using the backup and restore wizard. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download