IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG...

23
IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG [email protected]

Transcript of IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG...

Page 1: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

IT Pro Day

SQL Server 2012 AllwaysOn

Stephan HurniMicrosoft V-TSPPrincipal Consultant, Trivadis [email protected]

Page 2: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

IT Pro Day

Trivadis solution portfolio and competencesIT SOLUTIONS, SERVICES & PRODUCTS

TECHNOLOGIES Microsoft, Oracle, IBM, Open Source

Integration, Application Performance Management, Security

InfrastructureEngineering

Application Development

Business Intelligence

Business Integration Services

Training

Managed Services

Page 3: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

IT Pro Day Trivadis facts & figures11 Trivadis locations with more than 600 employees

Financially independent and sustainably profitable

Key figures 2011

Revenue CHF 104 / EUR 84 Mio.

Services for more than 800 clients in over 1,900 projects

200 Service Level Agreements

More than 4,000 training participants

Research and development budget: CHF 5.0 / EUR 4 Mio.

Page 4: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

HADRHA Enhancementsin SQL Server 2012

Page 5: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

HA/DR Features before SQL 2012Failover ClusteringVirtual Networkname

(transparent)

Multidatabase failover

Shared storage needed

No active secondaries available

DR only with Storage Replication or Logshipping/

Database Mirroring

Database Mirroring

Fast Failover

No Shared Storage needed

Application has to be “mirroring-aware” (SNAC or connectstring modification)

No virtual network name to connect

Only 1 active secondary with database snapshots on the

mirror

Log Shipping

Multiple Secondaries

No Shared Storage needed

Needs good monitoring

No automatic failover

Secondaries offline while applying transactionlog

backups

... List is not complete, Replication only for Table Level HA...

Page 6: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

AlwaysOn Availability GroupsAlwaysOn Availability Groups is a new feature that enhances and combines failover cluster, database mirroring and log shipping capabilities

Multi-database failoverMultiple secondaries

Total of 4 secondaries2 synchronous secondaries

1 automatic failover pairSynchronous and asynchronous data movementBuilt in compression and encryptionFlexible failover policyAutomatic Page Repair

Application failover using virtual nameConfiguration WizardDashboardSystem Center IntegrationRich diagnostic infrastructureFile-stream replicationReplication publisher failover

Flexible Integrated Efficient

Active SecondaryReadable SecondaryBackup from SecondaryAutomation using power-shell

Page 7: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

AlwaysOn Availability Groups Based on Windows Server Failover Cluster Conjunction of multiple Database Mirrors

with Failover Clustering

Page 8: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Availability Group Scenarios

Synchronous Data Movement

Asynchcronous Data Movement

AG AG

AG

AG

AG

Example• Primary in Calgary• Failover Partner in Vancouver• Sync DR in Toronto

• Async Secondary in Montreal (Reporting)

• Async Secondary in London (Geo DR)

Page 9: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

AlwaysOn | Topics Availability Databases

DBs can be added to availability groups as primary Availability Replicas | primary DBs can have up to 4

replicas Availability Modes

Asynchronous-commit mode Synchronous-commit mode (max. 2 secondaries)

Types of Failover ¦ planned manual, automatic Client Connections to VNN (virtual network name)

(group listener with unique DNS A-record + multiple C-Names)

Automatic Page Repair

Page 10: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Windows Server Failover Cluster Built-in as feature in Windows since 2003 Check Server Requirements

http://msdn.microsoft.com/en-us/library/ff878487(v=sql.110).aspx

Create Windows Cluster

Page 11: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Availability Groups Creator (cluster computer account in ADS) of AGs

must have rights in ADS join computers local administrative rights on nodes

Have Network Name, IP Address, Connection Port, min 1 Database, Listener Port and account for Availability Group ready

each AG has: own NN, IP Address, Connection Port Create multiple AGs for performance benefits

min 1 AG per Node (active processes per Node) approximately 40MB/sec throughput per AG

Combine multiple DBs belonging together to same AGs

Page 12: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

CREATE AVAILABILITY GROUP group_name WITH (<with_option_spec> [ ,...n ] ) FOR [ DATABASE database_name [ ,...n ] ] REPLICA ON <add_replica_spec> [ ,...n ] [ LISTENER ‘dns_name’ ( <listener_option> ) ][ ; ]

<with_option_spec>::= AUTOMATED_BACKUP_PREFERENCE = { PRIMARY | SECONDARY_ONLY| SECONDARY | NONE } | FAILURE_CONDITION_LEVEL = { 1 | 2 | 3 | 4 | 5 } | HEALTH_CHECK_TIMEOUT = milliseconds

<add_replica_spec>::= <server_instance> WITH ( ENDPOINT_URL = 'TCP://system-address:port', AVAILABILITY_MODE = { SYNCHRONOUS_COMMIT | ASYNCHRONOUS_COMMIT }, FAILOVER_MODE = { AUTOMATIC | MANUAL } [ , <add_replica_option> [ ,...n ] ] )

<add_replica_option>::= BACKUP_PRIORITY = n | SECONDARY_ROLE ( { [ ALLOW_CONNECTIONS = { NO | READ_ONLY | ALL } ] [,] [ READ_ONLY_ROUTING_URL = 'TCP://system-address:port' ] } ) | PRIMARY_ROLE ( { [ ALLOW_CONNECTIONS = { READ_WRITE | ALL } ] [,] [ READ_ONLY_ROUTING_LIST = { ( ‘<server_instance>’ [ ,...n ] ) | NONE } ] } ) | SESSION_TIMEOUT = integer

<listener_option> ::= { WITH DHCP [ ON ( <network_subnet_option> ) ] | WITH IP ( { ( <ip_address_option> ) } [ , ...n ] ) [ , PORT = listener_port ] }

<network_subnet_option> ::= ‘four_part_ipv4_address’, ‘four_part_ipv4_mask’

<ip_address_option> ::= { ‘four_part_ipv4_address’, ‘four_part_ipv4_mask’ | ‘ipv6_address’ }

Create Availability Groups

http://technet.microsoft.com/de-de/library/ff878399.aspx (CREATE AVAILABILITY GROUP (Transact-SQL)

Page 13: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Flexible failover policy

ALTER AVAILABILITY GROUP AV01 SET (FAILURE_CONDITION_LEVEL = 1)

ALTER AVAILABILITY GROUP AG1 SET (HEALTH_CHECK_TIMEOUT = 60000)

Page 14: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

HADR system viewsselect * from sys.dm_hadr_availability_group_statesselect * from sys.dm_hadr_availability_replica_cluster_nodesselect * from sys.dm_hadr_availability_replica_cluster_statesselect * from sys.dm_hadr_availability_replica_statesselect * from sys.dm_hadr_clusterselect * from sys.dm_hadr_cluster_membersselect * from sys.dm_hadr_cluster_networksselect * from sys.dm_hadr_database_replica_cluster_statesselect * from sys.dm_hadr_database_replica_statesselect * from sys.dm_hadr_instance_node_mapselect * from sys.dm_hadr_name_id_mapselect * from sys.dm_hadr_auto_page_repair

select routing_priority, read_only_routing_url, replica_server_name, endpoint_url

from sys.availability_read_only_routing_lists Ajoin sys.availability_replicas B on A.replica_id = b.replica_id

Page 15: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Demo

Availability Groups

AG’s

Page 16: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Availability Groups Settings/Monitor

Page 17: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Read_only secondaries Read_only with Database Mirroring? Read_only with HADR Availability Groups

Secondaries are readable but not updateable Routing List SQLcmd

with SSMSDB context

-E –S AV01 -K ReadOnly -d AV -Q [Query]

ApplicationIntent=ReadOnly

Page 18: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Backup secondaries Save Network bandwith for redundant Full

Backups copy_only for Full Backups Take care of backup location for TXLog Backups

TXlog-chain!!! HADR backup perferences

select sys.fn_hadr_backup_is_preferred_replica ('AV')

Page 19: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Demo

Read-only secondariesBackup secondaries

Backupread-only

Page 20: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Database Maintenance Have a solid standardized and automated

Maintenance in place think of failover situations

Beware of new Databases behaviors in AGs read_only Backup secondaries

Optimize/Change your Database Maintenance Jobs ask Trivadis how to Maintain SQL Server Databases

and deserve more

Page 21: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Questions

SQL Server 2012 HADR

Thinking …

Page 22: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

Am Trivadis Stand

Signed by

Thomas Huber

1. Preis

2. Preis

3. Preis

Wettbewerb

Page 23: IT Pro Day SQL Server 2012 AllwaysOn Stephan Hurni Microsoft V-TSP Principal Consultant, Trivadis AG stephan.hurni@trivadis.com.

© 2012 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.