Top 5 TIPS TO KEEP Always on AGs humming and users happy

Slides:



Advertisements
Similar presentations
Implementing SQLServer AlwaysON Sarabpreet Singh Anand SQL Server – MVP SQLServerGeeks.com (VP)
Advertisements

0 SQL Server AlwaysOn – SharePoint 2013 High Availability and Disaster Recovery Sal Bawany, Solutions Architect
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Virtual techdays INDIA │ September 2011 High Availability - A Story from Past to Future Balmukund Lakhani │ Technical Lead – SQL Support, Microsoft.
SQL Server 2012 Always On Premier Field Engineer Microsoft Corporation Lisa Gardner
SharePoint Business Continuity Management with SQL Server AlwaysOn
Chapter 10 : Designing a SQL Server 2005 Solution for High Availability MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design.
Architecting Availability Groups
Maintaining a Mirrored Database Tips and Tricks by Paul G. Hiles.
SQLintersection Session SQL37 SQL Server 2012 Availability Groups Aaron Bertrand
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Speaker Name 00/00/2013. Solution Requirements.
Alwayson Availability Groups
Martin Cairney Hybrid data platform – making the most of Azure plus your on- prem kit DAT341 B.
Architecting Availability Groups An analysis of Microsoft SQL Server Always-On Availability Group architectures 1.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 19/09/2015David Postlethwaite.
SQL Server High Availability Introduction to SQL Server high availability solutions.
All the things you need to know before setting up AlwaysOn Michael Steineke SQL & BI Solution Lead Enterprise Architect Concurrency, Inc.
Windows Server Failover Clustering (WSFC) with SQL Server.
Architecting Availability Groups An analysis of Microsoft SQL Server Always-On Availability Group architectures 1.
AlwaysOn In SQL Server 2012 Fadi Abdulwahab – SharePoint Administrator - 4/2013
Architecting Availability Groups An analysis of Microsoft SQL Server Always-On Availability Group architectures 1.
SQL 2012 – Always On Deep Dive Bob Duffy Database Architect Prodata SQL Centre of Excellence 11 th April 2013.
ALWAYSON AVAILABILITY GROUPS Replicas, Listeners & Quorums, Oh My! Kevin Howell SQL Saturday #517 Philadelphia, June 2016.
Architecting Enterprise Workloads on AWS Mike Pfeiffer.
Backups for Azure SQL Databases and SQL Server instances running on Azure Virtual Machines Session on backup to Azure feature (manual and managed) in SQL.
Sponsors.
Business Continuity for Virtual SQL Servers
You Inherited a Database Now What?
Automated Restore Script Output for Ola Hallengren’s Maintenance Solution 1) Start SQL Services on Local 2) Connect to Azure AlwaysOn 3) Delete all maintenance.
SQL Replication for RCSQL 4.5
Architecting Availability Groups
ALWAYSON AVAILABILITY GROUPS
Disaster Recovery Where to Begin
Lead SQL BankofAmerica Blog: SQLHarry.com
AlwaysOn Mirroring, Clustering
Always On Multi-Site Patterns
Designing Database Solutions for SQL Server
Extensible Platform Microsoft Dynamics 365
Summit Nashville /28/2018 8:42 PM
Installation and database instance essentials
Always On : Multi-site patterns
AlwaysOn Availability Groups 101
Multi-Farm, Cross-Continent SharePoint Architecture
Disaster Recovery Where to Begin
Architecting Availability Groups
How to keep your database servers out of the news Matt Gordon
Re-Indexing - The quest of ultimate automation
What’s new in SQL Server 2016 Availability Groups
Planning High Availability and Disaster Recovery
Always On : Multi-site patterns
Example of a page header
Cloud Data Replication with SQL Data Sync
AlwaysOn Availability Groups
High Availability/Disaster Recovery Solution
Top 5 TIPS TO KEEP Always on AGs humming and users happy
Distributed Availability Groups
Speaker info Matt Gordon Architect
Using Dbatools to Automate Database Migrations
The Force Within Management Data Warehouse
04 | Always On High Availability
Using Distributed AGs for Your Migrations
Sql Saturday Philadelphia
How To Load A Fact Table Really, Really Fast
Top 5 TIPS TO KEEP Always on AGs humming and users happy
Making your M Queries Dynamic in Power BI
SQL AlwaysOn Availability Groups
Designing Database Solutions for SQL Server
The DBA Quit and now you’re it:
Presentation transcript:

Top 5 TIPS TO KEEP Always on AGs humming and users happy Matt Gordon

http://jssug.com

https://tinyurl.com/y6spgfwn Slack Channel – https://jssug.slack.com #jssug #sqlhelp #jobhelp #sqlsatjax https://tinyurl.com/y6spgfwn

Please Take Pictures and Post! #SQLSatJax @JSSUG

501 Legion Charitable Donation Thank the 501 Legion for Supporting Our Event! JSSUG Will Match Donations up to $200 Donation Bucket on Registration Table

Don’t forget Session Evals for Speakers! Don’t forget Event Evals for xBox Raffle! Schedule is Online and in GuideBook App

Modern Migration Tour Register: https://tinyurl.com/y6qom9n3 When: June 15, 2019 Where: UNF Sponsored by: PASS, Microsoft & Intel In the lead up to SQL Server 2008 end of support, PASS has recruited Sandy—an expert in all things migration—along with an all-star lineup of speakers from Microsoft and Intel®, to smoothly guide you to your final destination—a modern data platform. Whether you’re interested in moving to an updated on-premises, cloud, or hybrid solution; PASS, Microsoft, Intel®, and Sandy (of course!) have teamed up for a must attend series of webinars, in-person events, and migration resources, dedicated to giving you the tools you need to migrate with confidence.

Speaker info Matt Gordon Architect Matt.Gordon@insight.com : @sqlatspeed www.sqlatspeed.com

About ME 15+ years of SQL Server experience Microsoft Data Platform MVP IDERA ACE Managed 24x7 datacenters Worked on development teams MCSE: Data Management and Analytics PASS Summit 2017 and 2018 speaker Leader of Lexington, KY (USA) PASS Local Group

How I picked my twitter handle and domain name

About you Who is responsible for administering an Always On AG? Who thinks they will be responsible for that in the near future? If you are responsible for an AG, is it in production? Do you have AGs only in production? Are you only here because you heard I’m from Kentucky and might have Derby tips?

Today’s AGENDA Tip 0: Everybody On The Same Page Tip 1: Quorum Design Tip 2: Read-only Routing Lists Tip 3: Users and Logins Tip 4: Backup Strategies Tip 5: Maintenance Strategies

LIVE LOOK AT ON-CALL DBA’s FACE

EVERYBODY ON THE SAME PAGE Do not set up Availability Groups in a vacuum Collaboration with operations Collaboration with networking Service level agreements (SLA) drive design Legal consequences Corporate consequences

EVERYBODY ON THE SAME PAGE Customer needs should also be considered Business dependent Set expectations based on implementation and support costs

EVERYBODY ON THE SAME PAGE Processes are critical Defined Repeatable Testable Personnel are critical Best design hamstrung by lack of training Talent and training are key

Quorum votes: Your VOTE COUNTS! What is cluster quorum? How the cluster monitors its health Why is it important? Cluster will be set offline if quorum is absent Availability group listener is a cluster resource AG will be inaccessible if quorum is lost Who decides on the design? Should be collaborative between DBA and ops DBA should understand design

Quorum votes: Your VOTE COUNTS! Quorum Modes Node Majority Recommended if you have an odd number of voting nodes Node and File Share Majority Recommended if you have an even number of voting nodes and multi-site cluster Also recommended if you have an even number of voting nodes and no shared storage Node and Disk Majority Requires shared disk cluster resource Recommended for even number of nodes but no multi-site Disk Only Cloud Witness with Windows Server 2016 or later

Read-only routing lists: distributing the workload What is a read-only routing list? Directs read-only connections to readable secondaries Configured per availability group node Not load-balancing mechanism until SQL Server 2016 What is required to setup a read-only routing list? AG must have a listener One or more replicas must be readable secondaries

Copy user logins: accessible and available data SQL Server security objects Users at database level Logins at instance level Users Will be a part of each replica database No additional setup required Logins Will need to be recreated for each instance Sp_help_revlogin makes this much easier

DEMO: Keeping logins consistent across AGs

Copy user logins: other options https://www.sqlskills.com/free-tools/ssms-availability-group-add-in Only works with SQL Server 2012/2014 at this time Will sync both logins and jobs https://sql2012alwaysonlogin.codeplex.com SSIS package to sync only logins to replicas

Copy user logins: Best option https://dbatools.io @psdbatools on Twitter Copy-DbaLogin Copy-DbaAgentJob Examples: Copy-DbaLogin –Source <server> -Destination <server> Copy-DbaAgentJob –Source <server> -Destination <server> More examples found at https:/docs.dbatools.io Looks like SQL 2019 will have system databases in AGs so all of this may be moot

Regular transaction log backups: backups to help the database keep up Transaction log backup strategy Depends on database workload Important to regulate transaction log size “Do something, even if it’s wrong” Monitor your backups Improve recovery time Minimize use of storage resources Avoid the dreaded shrinking operations

BACKUP OPTIONS AG REPLICAS Types of backups available on replicas COPY-ONLY full backups of databases, files, or filegroups on secondary replicas BACKUP LOG supports only regular log backups COPY_ONLY option not supported for log backups on secondary replicas Log chain is maintained across log backups taken on any replicas Recommended best practices Set AUTOMATED_BACKUP_PREFERENCE via CREATE or ALTER AVAILABILITY GROUP PRIMARY, SECONDARY_ONLY, SECONDARY, NONE Set BACKUP_PRIORITY via CREATE or ALTER AVAILABILITY GROUP Ranges from 1 to 100 (1 lowest, 100 highest) 0 indicates no availability for backups Create backup jobs on all replicas using sys.fn_hadr_backup_is_preferred_replica(@DBNAME) Replica must be in SYNCHRONIZING or SYNCHRONIZED state

Stagger index maintenance: slow down to speed up Regular index maintenance If you are not doing this, you should be Strategy depends on workload Reorganize operations may generate more log traffic and will take longer than rebuilds Especially for large, heavily fragmented indexes Effect on replicas Large operations can generate lots of log traffic Log data must be transported to/restored at replica

Stagger index maintenance: do’s and don’ts Staggering do’s and don’ts DO ensure that all large indexes are not being rebuilt at nearly the same time DO closely monitor the lag between primary and replicas when first implementing index maintenance DO NOT reorganize every index each day at the same time lest your network look like the picture

DEMO: checking ag replica lag

Stagger maintenance: checking ag replica lag select SYSDATETIME(), arcs.replica_server_name, drcs.database_name, drs.synchronization_state_desc, ars.synchronization_health_desc, CASE WHEN drcs.is_failover_ready=0 THEN 'Possible Data Loss' WHEN drcs.is_failover_ready=1 THEN 'No Data Loss' END as is_failover_ready, ISNULL(convert(varchar,drs.log_send_queue_size,113),'Is Current Primary') log_send_queue_size, ISNULL(convert(varchar,drs.last_sent_time,113),'Is Current Primary') last_sent_time, ISNULL(convert(varchar,drs.last_received_time,113),'Is Current Primary') last_received_time, drs.last_commit_lsn, drs.last_commit_time, drs.last_hardened_lsn, ISNULL(convert(varchar,drs.last_hardened_time,113),'Is Current Primary') last_hardened_time, ISNULL(convert(varchar,drs.last_sent_lsn,113),'Is Current Primary') last_sent_lsn, ISNULL(convert(varchar,drs.last_received_lsn,113),'Is Current Primary') last_received_lsn, ISNULL(convert(varchar,drs.redo_rate,113),'Is Current Primary') redo_rate, ISNULL(convert(varchar,drs.redo_queue_size,113),'Is Current Primary') redo_queue_size, ars.role_desc from sys.dm_hadr_availability_replica_states ars join sys.dm_hadr_database_replica_states drs on ars.replica_id = drs.replica_id join sys.dm_hadr_database_replica_cluster_states drcs on drs.group_database_id = drcs.group_database_id and drs.replica_id=drcs.replica_id join sys.dm_hadr_availability_replica_cluster_states arcs on drcs.replica_id=arcs.replica_id order by arcs.replica_server_name, drcs.database_name;

Stagger maintenance: SSMS 2017 AG Latency Reports New in SSMS 17.4 (released 12/7/17) Clicking “Collect Latency Data” on the AG dashboard starts the collection SQL Server Agent needs to be running on primary and at least one secondary What does it do? Creates Extended Event session that runs for 2 minutes Extracts data into temp tables for report result sets Drops the Extended Event session

Stagger maintenance: SSMS 2017 AG Latency Reports (primary) What do they show? Primary replica’s average commit time and average hardening time Statistics for commit duration, remote harden duration, time spent in compression, and send duration for log block

Stagger maintenance: SSMS 2017 AG Latency Reports (secondary) What do they show (continued)? Secondary replica’s send time Average time spent writing a log block (local flush), decompression time, receive time, send time Gotchas Only enabled for Windows Auth accounts with sysadmin Can only run one collection at a time Requires 2014 SP2, 2016 SP1, or 2017 RTM More info here: http://bit.ly/2DYORws

Questions?

Thanks for ATTENDING! Matt Gordon Architect Matt.Gordon@insight.com : @sqlatspeed www.sqlatspeed.com