23
SQL Server 2012 Always On Premier Field Engineer Microsoft Corporation Lisa Gardner http://blogs.msdn.com/sqlga rdner

SQL Server 2012 Always On Premier Field Engineer Microsoft Corporation Lisa Gardner

Embed Size (px)

Citation preview

SQL Server 2012 Always On

Premier Field Engineer

Microsoft Corporation

Lisa Gardner

http://blogs.msdn.com/sqlgardner

High Availability OutcomeOptions

Understanding of High Availability Options in SQL Server 2012Benefits of AlwaysOn HA design patterns utilizing AlwaysOn

Agenda

High Availability OptionsAlwaysOn DemoReadable SecondariesReadable Secondaries DemoAlwaysOn Design Patterns

High Availability Options

Pre-SQL Server 2012What's New in SQL Server Failover Clustering?SQL Server 2012 AlwaysOn

Pre-SQL Server 2012 High Availability Options

Backup/RestoreWindows/SQL Server Failover ClusteringLog ShippingDatabase MirroringThird Party

SAN Replication

AlwaysOn Technologies – Managed by WSFC

WSFC

AGFCI

What’s New in SQL Server Failover Clustering?

AlwaysOn Failover Cluster Instance provides instance level failoverKey SQL Server 2012 Clustering Enhancements

Multi-site geo-clustering across subnetsFlexible Failover PolicyImproved system diagnosticsSupport for network attached storage(NAS) user SMBSupport for TempDB on local drive (SSD)

Flexible Failover Policy (SQL Server 2012)

Control over when automatic failover should be initiatedConfigurable options eliminate false failoverImproved logging for better diagnosticsNew Cluster Properties

HealthCheckTimeoutFailureConditionLevel

Failure Condition Levels

0 – No Automatic Failover or restart

Service is down

1 – Failover or restart on server down

No response from sp_server_diagnostics

2 – Failover or restart on server unresponsive

System errors3 – Failover or restart on critical SQL Server errors

Resource errors4 – Failover or restart on moderate SQL Server errors

Query Processing errors5 – Failover or restart on any qualified failure conditions

Always On Availability Groups

Allows a group of databases to failover as a logical unitUtilizes Windows Failover Cluster to report healthDefines a primary instance and up to four secondary instancesProvides automatic client redirection

AlwaysOn Concepts

Availability GroupAvailability ReplicaAvailability DatabaseAvailability Group Listener

SQL Server High Availability Options RecapHigh Availability and Disaster Recovery SQL Server Solution

Potential Data Loss

(RPO)

Potential Recovery

Time (RTO)

Automatic Failover

Readable Secondaries (1)

AlwaysOn Availability Group – synchronous-commit

Zero Seconds Yes(4) 0-2

AlwaysOn Availability Group – asyncronous-commit

Seconds Minutes No 0-4

AlwaysOn Failover Cluster Instance

NA(5) Seconds-to

minutes

Yes NA

Database Mirroring(2) – High-safety(sync + witness)

Zero Seconds Yes NA

Database Mirroring(2) – High Performance (async)

Seconds(6) Minutes(6) No NA

Logshipping Minutes(6) Minutes-to-

hours(6)

No Not during a restore

Backup Copy Restore(3) Hours(6) Hours-to-days(6)

No Not During a restore

DemonstrationCreating an Availability Group

Readable Secondaries

Mirrored copy of data on secondary serverActive Secondary servers provide off-loading functionality

Reading of data for reportingBackupsDBCC

Connect via Instance name

Active Secondary – Readable Routing

Allows for application to specify read Intent on ConnectionApplicationIntent – A New Connection PropertyConnect via listener

Read-Only RoutingOptimized for automatic routing of read only applicationsRoutes must be create created manually

Readable Secondary – Data Latency

Secondary reads are 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

DemonstrationLeveraging Active Secondaries

Query Performance on Secondary

SQL Server Uses Cost based optimizerRelies on object Statistics

If statistics are missing SQL Server creates and persistsAuto-stat on readable secondary will require updates?

Active Secondary : Enabling Backup on Secondary

Backups can be done on any replicaMust be able to communicate with primaryLog backups done on all replicas form a single log chainSend all backups to a single UNC pathDatabase Recovery advisor makes restores simple

Must include backups from other instances manually

Differential Backups are not supportedCopy-Only backups are the only type

I have a 4 part blog series on this topic for more details

AlwaysOn Troubleshooting

AlwaysOn DashboardSp_server_diagnosticsCatalog Views Examples

Sys.availability_groupsSys.availability_replicas

DMV are named sys.dm_hadr*New Performance Monitor Counter Objects

SQLServer:Database ReplicaSQLServer:Availability Replica

New Information Logged to the System Event Logs

AlwaysOn Design Patterns

White Board/Flip Discussion

Questions?

Conclusion

AlwaysOn provides many High Availability OptionsEnables Multi Site Failover with minimal effortAllows maintenance and read activity to be distributed