Denali – Always On Deep Dive 30 th Sept 2011 Bob Duffy Database Architect Prodata SQL Centre of...

27
Denali – Always On Deep Dive 30 th Sept 2011 Bob Duffy Database Architect Prodata SQL Centre of Excellence
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    213
  • download

    0

Transcript of Denali – Always On Deep Dive 30 th Sept 2011 Bob Duffy Database Architect Prodata SQL Centre of...

Denali – Always On Deep Dive

30 th Sept 2011

Bob DuffyDatabase ArchitectProdata SQL Centre of Excellence

Speaker Profile – Bob Duffy• Database Architect at Prodata SQL Centre Excellence, Dublin

• One of about 25 MCA for SQL Server globally (aka SQL Ranger)• SQL Server MVP, 2009+• MCM on SQL 2005 and 2008• 20 years in database sector, 250+ projects• Senior SQL Consultant with Microsoft 2005-2008

• Blog http://blogs.prodata.ie/bob

Agenda• Typical HADR Requirements• Always On Installation• Migrating to Availability Groups• Planned Failover• Automated Failover• Active Secondary Replicas• Integration with Failover Clustering

Case Study – Dell DVD Store Enterprises

Need to accept 24 x 7 transactionsFor High Availability

Zero down time and data loss (automatic)SLA to cover storage failure“I see web site unavailable and you are fired”

“Reporting” Near real time. No more than 1 minute behindWith minimal impact on live transactions

Disaster RecoveryHave second data centre. No more than 30 mins down time and 5 minutes data loss

UpgradeAny upgrade needs to be with no down time or data loss

Typical HA/DR/Reporting Architecture

DR Site

Application Server(s)

Denali Always On

DR Site

Application Server(s)

Secondary Replica(Automatic)

Secondary ReplicaRead Only

Synchronous

AsynchronousAsy

nch

ron

ou

s

Secondary Replica(Manual Async)

Installation

Always On relies on WSFC Always On is NOT a clustered install of SQLDoes not need Shared DiskWindows 2008 Server+ EE neededNeed to Enable HadrService

Via configuration managerOr via PowerShell

Some Patches and QFE NeededKB 976097KB 2494036  

Installation Cluster + HadrService

Migrating to Always On / Denali

Any normal migration is possible:Backup / RestoreAttach / DetachMirroringLog ShippingReplication

Might need some post migration tasksCompatibilityUse of new features such as Containment

Migrating to Denali

Creating your First Availability Group

Failover to Secondary

Quorum ChangesRequired for automatic failoverBuilt in feature of WSFCReplaces the concept of “witness” to avoid split brainTwo recommended Steps

1. Select nodes to vote2. Select the Quorum Type

If Odd number use “Node Majority”If even number use “Node Majority plus File Share Witness”

Requires QFE KB KB 2494036  to enable Voting

May need to adjust quorum after failover outside automatic target

Flexible Failover Policy

Flexible Failover Policy provides administrators control over the conditions when an automatic failover should be initiated.

Resource DLL

SQL Server

Select @@servername

SQL Server 2008 R2 SQL Server Denali

Resource DLL

SQL Server

sp_server_diagnostics

Diagnostics

Diagnostics

Configurable options eliminate false failoverImproved logging for better diagnostics

New Failure Condition LevelsLevel Condition Description

0 No Automatic Failure Maintenance Mode

1 Failover or restart on SQL Server down

Service Down

2 Failover or restart on SQL Server unresponsive

No data from sp_server_diagnostics

3* Failure of restart of critical Services sp_server_diagnosticsReturn ‘system error’

4 Failover or restart on moderate server errors

sp_server_diagnosticsReturn ‘resource error’

5 Failover or restart on any qualified failure conditions

sp_server_diagnosticsReturn ‘query processing error’

Automated Failover

Secondary Replica Features

FailoverBackup \ DBCCReporting QueriesAlwaysOn AutoStat Automatic Page Repair

Read Only Replicas

Secondary Replica – Active Log Sync

Log Cache

Log Cache

Secondary read is behind primaryLog is first hardened and then applied

Redo thread is asynchronous and runs in the backgroundLatency (typically seconds) can be larger for log intensive operations like bulk import or index create/rebuildSync Replica minimizes latency due to network issues

DB1

DB1 Log

DB1

Log Capture Log

Recieve

DB1 Data

Redo Thread

Redo Pages

DB1 Log DB1 Data

Page Updated

Log HardenLog Flush

Commit

Acknowledge Commit

Log Pool

Network

Auto-Stats on Readable SecondaryQuery Optimization and Statistics

SQL Server uses cost based optimizer that heavily relies on object statisticsIf statistics are missing, SQL Server automatically creates them and persists

Auto-stat on readable secondary will require physical Changes

Example: Table T1 (C1, C2, C3)Query on primary with predicate (C3 > 10). SQL Server auto-create the statistics, if needed, on column C3 on primary replicaWon’t work on Readable Secondary as it will cause physical changes to the database.

Similar issue if the statistical information is stale on the secondary replica.

SolutionAuto-create statistics on the secondary replica but persist them in TempDBExisting catalog views (e.g. sys.stats) show temporary statistics

Unplanned Disaster!

Availability Groups and Failover Cluster InstanceAvailability Groups integrates

seamlessly with AlwaysOn Failover Cluster Instance

Failover Cluster Instance used for local high availability

Availability Groups provide ability to failover to a disaster recovery site

> Automatic failover of the availability group is disallowed when one of the replicas is an FCI

Coming up…

#SQLBITS

Speaker Title Room

Quest Gruesome, Grotesque and Gory – Horrors Stories from the World of IT Aintree

Idera Tricks of the Trade - DBA tools Lancaster

Attunity Data Replication Redefined – best practices for replicating data to SQL Server Empire

Fusion-io Myths and Monsters of Flash Derby

SQLSentry Real Time and Historical Performance Troubleshooting with SQL Sentry Pearce

Questions ?

AlwaysOn Resources“Denali” AlwaysOn Resource Center: http://msdn.microsoft.com/en-us/sqlserver/gg490638(en-us,MSDN.10)

CTP downloadDocumentationMSDN forumsMicrosoft ConnectAlwaysOn Blog

Trace Flag 9532 TSQL features

CREATE AVAILABILITY GROUP Transact-SQL options:Using more than two REPLICA ON clausesFAILURE_CONDITION_LEVELHEALTH_CHECK_TIMEOUTSESSION_TIMEOUT

Using any of the following ALTER AVAILABILITY GROUP Transact-SQL options:

ADD REPLICA ONREMOVE REPLICAADD DATABASEREMOVE DATABASEENDPOINT_URLFAILURE_CONDITION_LEVELHEALTH_CHECK_TIMEOUTSESSION_TIMEOUT

Important – Trace Flag 9532

Some Always On Availability Groups features require that the instances of SQL Server that host availability replicas have been enabled for trace flag 9532. For information about which Transact-SQL options require enabling this trace flag,

Thank You!