balmukund lakhani technical lead – sql support | microsoft gtsc | blakhani@microsoft.com team...

Post on 22-Dec-2015

220 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

High Availability options Explored with SQL Server

Balmukund LakhaniTechnical Lead – SQL Support | Microsoft GTSChttp://blogs.msdn.com/blakhani | blakhani@microsoft.comTeam Blog – http://blogs.msdn.com/SQLServerFAQ

About me…

Working with SQL Technology since 2001 (almost 10 years)Currently working as Technical Lead with Microsoft SQL Support team.Premier Field Engineer @ MicrosoftDeveloper @ Ramco SystemsDBA @ Ramco SystemsERP Onsite Support @ Ramco Systems

Agenda

Why High Availability?Backup/restore related technologies.Database SnapshotsLog-shippingDatabase MirroringFailover ClusteringReplicationSQL Server “Denali” High Availability

Business Needs

RTO (Recovery Time Objective)The duration of acceptable application downtime, whether from an unplanned outage or from scheduled maintenance/upgrades

RPO (Recovery Point Objective)The ability to accept potential data loss from an outage

Causes of Downtime and Data Loss

Planned Downtime*Performing database maintenancePerforming batch operationsPerforming an upgrade.

Unplanned DowntimeData center failureServer failureI/O subsystem failureHuman error

What do we need?

Minimize or avoid service downtimeWhether planned or unplanned

When components fail,service interruption is brief or non-existent

Automatic failoverEliminate single points of failure (as affordable)

Redundant componentsFault-tolerant servers

Single-Instance Technologies

Backup, Restore, and Related Technologies

Partial Database Availability and Online Piecemeal RestoreInstant File InitializationMirrored BackupsBackup ChecksumsDatabase SnapshotsBackup Compression

Minimizing downtime

Backup Size

Backup Time

Restore Time

0

1

2

3

4

5

6

No CompressionCompression

Backup Compression

Backup compressi

on

Hot- Add CPU

Hot-Add memory

Online Operation

s

4.01GB

34.2 MB

295.8s

126.7s219s

126s

Database Snapshots

What Are Database Snapshots?

Read-only, consistent view of a database

Specified point-in-time

Modifying dataCopy-on-write of affected pages

Reading dataAccesses snapshot if data has changedRedirected to original database otherwise

12:00 Snapshot

Page

Page

Using Database Snapshot to Recover Data

Scenario Example Code / Steps

Undeletingrows

Undoingan update

Recoveringa droppedobject

11 Script the object in the database snapshot

INSERT INTO Production.WorkOrderRoutingSELECT * FROM AdventureWorks_dbsnapshot_1800.Prod.WorkOrderRouting

INSERT INTO Production.WorkOrderRoutingSELECT * FROM AdventureWorks_dbsnapshot_1800.Prod.WorkOrderRouting

UPDATE HR.DepartmentSET Name = ( SELECT Name FROM AdventureWorks_dbsnapshot_1800.HR.Department WHERE DepartmentID = 1)WHERE DepartmentID = 1

UPDATE HR.DepartmentSET Name = ( SELECT Name FROM AdventureWorks_dbsnapshot_1800.HR.Department WHERE DepartmentID = 1)WHERE DepartmentID = 1

Caution: Not a substitute for a comprehensive backup and restore strategy

Execute the script in the source database22

Repopulate the object (if appropriate)33

Database Snapshot

Demo

Transaction log restore - Puzzle

Full backu

p 1 (12:00 PM)

T-Log backu

p 1 (1:00 PM)

T-Log backu

p 2 (2:00 PM)

T-Log backu

p 3 (3:00 PM)

Full backu

p 2 (3:25 PM)

T-Log backu

p 4 (3:35 PM)

03:22 PM

Multi-Instance Technologies

Log Shipping

Log shipping allows you to automatically send transaction log backups from one database to a secondary database on another serverLogs are restored automaticallySecondary server can be the failover server and can become primary if the main server goes down

Copy

Copy

Copy

Perform Backups

Copy and Restore Backups

RaiseAlerts

Primary Database

Monitor Database

Secondary Database

Secondary Database

Secondary Database

Copy and Restore Backups

Copy and Restore Backups

Log Shipping (in Action)

Strength & weakness

StrengthsCan Ship Logs Across WAN (Wide-Area Network)Protects an Entire Database

WeaknessesConfigured Per DatabaseNO AUTOMATIC FAILOVER

Log shipping

Demo

Database Mirroring

Database Mirroring How it works

MirrorPrincipal

Witness

Log

Application

SQL Server SQL Server

2

2

4

51

Data DataLog

3>2 >3

Mirror is always redoing – it remains currentCommit

Database Mirroring ModesHigh-Availability Mode

Safety Full; Synchronous operationDatabase is available whenever a quorum existsAutomatic failover

High-Protection ModeSafety Full; Synchronous operationNo witness – quorum provided by partnersIf Principal loses quorum, it stops servicing the database

Ensures high protection; database is never in ‘exposed’ state

Manual failover only; no automatic failoverA transition mode; should not be in this mode for long

High-Performance ModeSafety Off; Asynchronous operationManual failover only

Supports only one form of role switching: forced service (with possible data loss)

Principal

Witness

Data Log

Mirror

Data Log

1. Bad Page

DetectedX

2. Request page

3. Find page

4. Retrieve page

5. Transfer page6. Write

Page

DBM – Automatic Page Recovery

Client

CPU goes up when compression is on, both because of compression/decompression, but also because the server can now process more transactions per second

Percentage increases in throughput is most dramatic for low network bandwidths

DBM – Log Compression

Strength & Weakness

StrengthsCan Mirror Across WANAutomatic Failover, and Nearly Instantaneous, Better than Failover ClusteringProtects an Entire Database

WeaknessesRequires Enterprise EditionMust be Configured Per Database

Mirroring Setup

Demo

Auto Page Repair

Demo

Failover Clustering

Virtual Server

Failover Clustering

Supports many scenarios: • Single Instance• Multiple Instance• Multiple Active Nodes• N+1• N+M

N+1: N Active, 1 Inactive Nodes

Inst2 *

* Inst1

Multiple Active Nodes

Inst2 *

* Inst1Inst3 *

N+M: N Active, M Inactive Nodes

Failover Cluster

* Inst1

SQL Server Cluster Topologies

Failover Clustering (Facts)Redundancy at database instance level

All databases fail over togetherShared copy of system databases

Single data copy on shared storage deviceNo I/O overhead reducing throughputStorage unit is single point of failure for cluster

All database services are clusteredSQL Agent; Analysis Services; Full-Text engine, MS DTC

Automatic failover (up to minutes)DBMS accessed over virtual IPStorage is controlled by one cluster node at a timeRequires hardware certified by Microsoft for Microsoft Cluster Service

Strength & Weakness

StrengthsProvides Protection Against a Node Failure, Protects the Entire SQL InstanceAutomatic Failover Supported

WeaknessesGenerally Expensive, Requires Specialty HardwareSpecialty Hardware RequirementsNot Trivial to Configure and ManageDoesn’t Protect Against a Complete

Site Failure

Replication

Primarily used where availability is required in conjunction with scale out of read activityFailover possible; a custom solutionNot limited to entire database; Can define subset of source database or tablesCopy of database is continuously accessible for read activityLatency between source and copy can be as low as seconds

Peer-to-Peer Replication

Provides high availability and read scalabilityBuilds redundancy by eliminating single point of failureEnable online upgrades of serversMaximize Application UptimeSupport for both Ring and Grid TopologyCentralized Management using Management Studio

Peer Node

Peer Node

Peer Node

Peer Node

New Features

Application Server

Load BalancingRead

Write

Replicated Data

User Request

s

Add and remove nodes without stopping

Visual configuration with Topology Wizard

Ability to detect conflicts

Strength & Weakness

StrengthsPerpetual or on-demand replication of data, local or remoteProtects (duplicates or merges) the exact portion of the database I want

WeaknessesConfigured per database, even per tableGenerally does not protect or duplicate an entire Database

SQL Server “Denali” High Availability

SQL Server AlwaysOn

Increased Application Availability at Lower TCO with Ease of Use:

Multi-Database FailoverMultiple SecondariesActive Secondaries Fast Client Connection RedirectionWindows Server CoreMultisite Clustering

Availability Group Concepts

Availability GroupDefines the high availability requirements

Databases, Replicas, Availability Mode, Failover Mode etc

Availability ReplicaSQL Server Instances that are part of

the availability group which hosts the physical copy of the database

Role: Primary, Secondary, Resolving

Availability DatabaseSQL Server database that is part of an availability groupThis can be a regular database or contained database

Readable Secondary

Readable secondary allow offloading read queries to secondaryClose to real-time data, latency of log synchronization impact data freshness

DB2

DB1

SQLservr.exe

SQLservr.exe

InstanceA

DB2

DB1

Primary Secondary

Database Log Synchronization

InstanceB

Reports

SQL Server “Denali” High Availability

• Configuration• Read-only Secondary

Demo

Comparing High Availability Technologies

CategoryAvailability

FeatureFailover

ClusteringDatabase Mirroring

Log Shipping Replication

Failover characteristics

Standby Type Hot Hot Warm Hot

Automatic role change

Yes Yes No No

Failover TypeAutomatic and

ManualAutomatic and

ManualManual Manual

Database Downtime during

failover

30 secs + database recovery

Less than 10 secs

Variable Variable

Physical Configuration

Redundant Storage

LocationsNo Yes Yes Yes

Hardware requirements

Microsoft certified cluster

solutionsStandard servers Standard servers Standard servers

Physical distance limit

100 miles None None None

Additional server role

None Witness Monitor Distributor

Comparing High Availability Technologies

CategoryAvailability

FeatureFailover

ClusteringDatabase Mirroring

Log Shipping

Replication

Management Complexity High Low Low Medium

Standby Accessible

NoVia Database

SnapshotsRead Only Yes

Multiple Secondaries

No No Yes Yes

Load delay on secondary

No No Yes No

Scope of Availability

Server Instance Database Database Database

Client Access Client redirect None requiredSupport in SNAC

and ADO.NET

Custom coding

required

Custom coding

required

SummarySQL Server High Availability Technology

Database Server Failure or Disaster

Failover ClusteringDatabase MirroringPeer-to-Peer Replication

User or Application ErrorLog ShippingDatabase Snapshot

Data Access Concurrency Limitations

Snapshot IsolationOnline Index OperationsReplication

Database Maintenanceand Operations

Fast RecoveryPartial AvailabilityOnline RestoreMedia ReliabilityDedicated Administration ConnectionDynamic Configuration

Availability at ScaleData PartitioningReplication

TuningDatabase Tuning Advisor

References

SQL Server Code Name Denali CTP1http://www.microsoft.com/sqlserver/en/us/product-info/future-editions.aspx SQL Server Books Online

Feedback / Q&A

Your Feedback is Important!Please take a few moments to fill out our

online feedback form at: www.virtualtechdays.com

For detailed feedback, use the form at http://www.connectwithlife.co.in/vtd/helpdesk.aspx

Or email us at vtd@microsoft.com

Use the Question Manager on LiveMeeting to ask your questions now!

Contact

Blog Addresshttp://blogs.msdn.com/BLakhani

http://blogs.msdn.com/SQLServerFAQ

Email Addressblakhani@microsoft.com

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

top related