52
Backup and Restore SQL Server Databases in Microsoft Azure Andrew McDermid and Pinal Dave

Backup and Restore SQL Server Databases in Microsoft Azure

Embed Size (px)

Citation preview

Page 1: Backup and Restore SQL Server Databases in Microsoft Azure

Backup and Restore SQL Server Databases

in Microsoft Azure

Andrew McDermid and Pinal Dave

Page 2: Backup and Restore SQL Server Databases in Microsoft Azure

Please silence cell phones

Silence Cells

Page 4: Backup and Restore SQL Server Databases in Microsoft Azure

Session Evaluations

ways to access

Go to passSummit.com Download the GuideBook App

and search: PASS Summit 2016

Follow the QR code link displayed

on session signage throughout the

conference venue and in the

program guide

Submit by 5pmFriday November 6th toWIN prizes

Your feedback is important and valuable. 3

Page 5: Backup and Restore SQL Server Databases in Microsoft Azure

Agenda

Is this where you want to be? In here we are talking about...

• SQL Server in Azure Virtual Machines

• SQL Server Database Backups in Azure Virtual Machines

• Azure Storage Accounts

Page 6: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

6

Page 7: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

7

Page 8: Backup and Restore SQL Server Databases in Microsoft Azure

Pinal DaveSQL Authority

Pinal Dave is a technology enthusiast and an independent consultant. He has authored 11 SQL Server database books, 21 Pluralsight courses and have written over 3800 articles on the database technology on his blog at a http://blog.sqlauthority.com. Along with 14+ years of hands on experience he holds a Masters of Science degree and a number of database certifications.

/pinaldave @sqlauthority

Page 9: Backup and Restore SQL Server Databases in Microsoft Azure

Andrew McDermidMicrosoft SQL DBA, Datavail

Corporation

Andy is a MCITP certified MS SQL DBA who delivers and manages delivery of DBA services to many diverse clients. He enjoys helping his clients by finding and deploying pragmatic and practical solutions for their database issues.

/andrewmcdermid @oldskipole

Page 10: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

10

Log

512GB

Data

512GB

• 2 DISKS

• 1 SQL data

• 1 SQL logs

Page 11: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

11

Log

512GB

Data

512GB

Backups

• 3 DISKS

• 1 SQL data

• 1 SQL logs

• 1 Backups

Page 12: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

12

Log

512GB

Data

512GB

Backups

• 4 DISKS

• 1 SQL data

• 1 SQL logs

• 1 Backups

• 1 TempDB

TempDB

Page 13: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

13

• Server Stats

• 4 CPU

• 14GB RAM

• 28GB D:\

Page 14: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

14https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/

Siz

es

for

vir

tual m

ach

ines

in A

zure

Page 15: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

15 https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/

Page 16: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/

DS3_V2

Standard

• 192 MB/sec

Page 17: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

DS3_V2

Standard

• 192 MB/sec

• 8 Data Disk

https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/

Page 18: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

18

Log

512GB

Data

512GB

• 2 DISKS

• 1 SQL data

• 1 SQL logs

Page 19: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

19

Log

512GB

Data

512GB

Backups

• 3 DISKS

• 1 SQL data

• 1 SQL logs

• 1 Backups

Page 20: Backup and Restore SQL Server Databases in Microsoft Azure

Backup to URLDemo

Page 21: Backup and Restore SQL Server Databases in Microsoft Azure

Backups to URL

21

• Azure Storage

Accounts

• Storage Account

Name

• Access Key

https://storageaccountname>.blob.core.windows.net

Azure

Storage Account

Page 22: Backup and Restore SQL Server Databases in Microsoft Azure

Backups to URL

22

EdwinaContainer

sql_serv

SQLSrvr01-

InstncASQLDEV

• Azure Storage

Accounts

• Storage

Account Name

• Access Key

• Container

Name

https://storageaccountname>.blob.core.windows.net/<container name>

Page 23: Backup and Restore SQL Server Databases in Microsoft Azure

Backups to URL

23

• SQL CREDENTIAL

• Credential Name

• Identity = Storage Account

Name

• Password = Storage

Account Key

TO URL = ‘https://storageaccountname>.blob.core.windows.net/<container name>/<backupfilename>.bak’

WITH CREDENTIAL = ‘<sql credential name>’

Page 24: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

24

Log

512GB

Data

512GBBackups

• 2 DISKS

• 1 SQL data

• 1 SQL logs

Page 25: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

25

Log

512GB

Data

512GB

• 4 DISKS

• 1 SQL data

• 1 SQL logs

• 6 unused

Page 26: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

26

Page 27: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

27

• PREMIUM DISK

• SSD

• Pay-for-capacity

• Dedicated I|O

• 500-5000 IOPS

• 100-200 MB/sec

P30

1TB

5000 IOPS

200 MB/sP20

512GB

2300 IOPS

150 MB/sP10

128GB

500 IOPS

100 MB/s

Premium

Page 28: Backup and Restore SQL Server Databases in Microsoft Azure

SQL Server Azure VMs

28

300MB/s

1TB

300MB/s

1TB

Log

46K IOPS

Data

46K IOPS

• 4 DISKS

• 2 SQL data

• 2 SQL logs

• 4 unused

Page 29: Backup and Restore SQL Server Databases in Microsoft Azure

P20

SQL Server Azure VMs

29

P20

P20

P20

P20

P20

50

100

150

200

250

300

350

400

MB

/sec 192

MB/s

DS3_v2

Page 30: Backup and Restore SQL Server Databases in Microsoft Azure

Backups to URL – What You Need

30

• Azure Storage Account• Storage Account Name+ Container Name

• Access Key

• SQL Server• SQL Server 2014 SP1 CU2 (min)

• SQL Credential

• TSQL Backup and Restore TO | FROM URL WITH CREDENTIAL

Page 31: Backup and Restore SQL Server Databases in Microsoft Azure

• Free-up a disk(s) for whatever…

IOPS, MB/s, TempDB;

utility/trace/log files; etc

• Works with maintenance plans,

scripts, SQL Agent jobs, etc.

Pros Cons

• Not local

• Thru-put limits per VM size

• No striped backups

• 1TB backup file limit

Backups to URL – Pros and Cons

Page 32: Backup and Restore SQL Server Databases in Microsoft Azure

Backup to Local Drive

32

DATABASE

STRIPED BACKUP SET

TO DISK

Database.1.bak

Database.2.bak

Database.3.bak

Database.4.bak

Page 33: Backup and Restore SQL Server Databases in Microsoft Azure

Backup to Local DriveDemo

Page 34: Backup and Restore SQL Server Databases in Microsoft Azure

Backup to Local Drive – What You Need

34

• Azure Storage Account• Storage Account Name + Container Name

• Access Key

• SQL Server• Any version

• TSQL Backup and Restore striped set TO | FROM URL

• AzCopy• /Dest: /Source: /Pattern:

• Automation script

Page 35: Backup and Restore SQL Server Databases in Microsoft Azure

• 1TB + DB backups

• Fast(-ish) backups via striping

• Fast copy to azure storage via

AZCopy

Pro Con

• Local disk storage capacity limits

• Local MB\sec limits

• Striped backup and offsite copy

management complexity

Backup to Local Drive – Pros and Cons

Page 36: Backup and Restore SQL Server Databases in Microsoft Azure

• Storage Account & Access Key

• Access Policy

• Shared Access Signature

Azure Storage Access and Security

36

Page 37: Backup and Restore SQL Server Databases in Microsoft Azure

Access and Security

37

Page 38: Backup and Restore SQL Server Databases in Microsoft Azure

Guess What Will Happen Next?

38

If Year was 2006 - BEFORE

If Year was 2016 - NOW

Page 39: Backup and Restore SQL Server Databases in Microsoft Azure

Access and Security - BEFORE

39

Page 40: Backup and Restore SQL Server Databases in Microsoft Azure

Access and Security - BEFORE

40

Page 41: Backup and Restore SQL Server Databases in Microsoft Azure

Access and Security - NOW

41

Page 42: Backup and Restore SQL Server Databases in Microsoft Azure

Access and Security - NOW

42

Page 43: Backup and Restore SQL Server Databases in Microsoft Azure

Shared Access Signature – What You Need

43

• CREATE SHARED ACCESS SIGNATURE WITH POWERSHELL

• Login to Azure Subscription

• Returns ‘CREATE CREDENTIAL‘ TSQL

https://msdn.microsoft.com/en-us/library/dn466430.aspx

Page 44: Backup and Restore SQL Server Databases in Microsoft Azure

Shared Access Signature – What You Get

44

• SQL CREDENTIAL

• Credential Name = URL

• Identity = “Shared Access

Signature”

• Password = SAS

URL

TO URL = ‘https://<storageaccountname>.blob.core.windows.net/<container name>/<backupfilename>1.bak’

URL = ‘https://<storageaccountname>.blob.core.windows.net/<container name>/<backupfilename>.2.bak’

URL = ‘https://<storageaccountname>.blob.core.windows.net/<container name>/<backupfilename>.3.bak’

URL = ‘https://<storageaccountname>.blob.core.windows.net/<container name>/<backupfilename>.4.bak’

Page 45: Backup and Restore SQL Server Databases in Microsoft Azure

Container

Shared Access Signature – What You Get

45

DATABASE

2TB

STRIPED BACKUP TO

URL

Database.1.bak

Database.2.bak

Database.3.bak

Database.4.bak

Page 46: Backup and Restore SQL Server Databases in Microsoft Azure

Striped Backups to URLDemo

Page 47: Backup and Restore SQL Server Databases in Microsoft Azure

Container

Shared Access Signature – What You Get

47

DATABASE

BACKUP TO URLDatabase.bak

1TB Max Backup File Size

Page 48: Backup and Restore SQL Server Databases in Microsoft Azure

Container

Shared Access Signature – What You Get

48

DATABASE

STRIPED BACKUP TO

URL

Database.1.bak

Database.2.bak

Database.3.bak

Database.4.bak

12.8TB Max Backup File Size

Page 49: Backup and Restore SQL Server Databases in Microsoft Azure

Striped Backups to URL- What You Need

49

• Azure Storage Account• Storage Account Name+ Container Name

• Access Key

• Shared Access Signature

• SQL Server• SQL Server 2016

• SQL “SAS” Credential

• TSQL Backup and Restore striped set TO | FROM URL

Page 50: Backup and Restore SQL Server Databases in Microsoft Azure

• Speed

• VLDB (12.8TB - 64 stripes of up to

200GB each)

Pro Con

• SQL 2016 + only

• VLDB (12.8TB - 64 stripes of up to

200GB each)

Striped Backups to URL – Pros and Cons

Page 51: Backup and Restore SQL Server Databases in Microsoft Azure

Session Evaluations

ways to access

Go to passSummit.com Download the GuideBook App

and search: PASS Summit 2016

Follow the QR code link displayed

on session signage throughout the

conference venue and in the

program guide

Submit by 5pmFriday November 6th toWIN prizes

Your feedback is important and valuable. 3

Page 52: Backup and Restore SQL Server Databases in Microsoft Azure

Thank You

Learn more from

Andy and [email protected] or follow @oldskipole

[email protected] or follow @pinaldave