24
ALWAYSON AVAILABILITY GROUP MAINTENANCE OPERATIONS Things you need to consider.

Always On Availability Group Maintenance Operations

Embed Size (px)

Citation preview

Page 1: Always On Availability Group Maintenance Operations

ALWAYSON AVAILABILITY GROUP MAINTENANCE

OPERATIONS

Things you need to consider.

Page 2: Always On Availability Group Maintenance Operations

Tuning blog: http://www.sqlperformance.com/

E-mail [email protected] for free copies of our $10 e-books:

Page 3: Always On Availability Group Maintenance Operations

YOUR PRESENTER• John Q Martin

o Sales Engineer for SQL Sentryo Worked with SQL Server for ~10 yearso Consultant, SQL DBA, Dev & BI Developero Former Microsoft Premier Field Engineer

• Contact Informationo Email: [email protected] Twitter: @SQLServerMonkeyo LinkedIn: https://uk.linkedin.com/in/johnqmartino Arrange a Demo: http://www.meetme.so/JohnQMartin

Page 4: Always On Availability Group Maintenance Operations

AGENDA• Introductions

• Maintenance Operations:o Synchronizing Loginso Statistics Maintenanceo Database Consistency Checkso Database Index Maintenanceo Synchronizing SQL Agent Jobs

• Summary

• Wrap Up

Page 5: Always On Availability Group Maintenance Operations

WHAT & WHY?

• SQL Server Maintenance Operations

• Impact of using AlwaysOn Availability Groups on common maintenance tasks.

• New maintenance tasks that you need to implement.

Page 6: Always On Availability Group Maintenance Operations

SYNCHRONIZE LOGINS

• Logins need to be synchronized between servers for Database Replicas

• Windows Loginso SID and other details from Active Directoryo Simple create login statement

• SQL Loginso Need SID and Password Hash from server where database originated.

Page 7: Always On Availability Group Maintenance Operations

SYNCHRONIZE LOGINS

• Important to define synch process between replicaso Downstream from primary or from where the change was made?o How to handle conflicts?

• Optionso Manuallyo SSIS packageo PoSho T-SQLo Custom process

Page 8: Always On Availability Group Maintenance Operations

DEMOSynchronizing SQL Server Logins between Availability Group

Replicas.

Page 9: Always On Availability Group Maintenance Operations

TEMPORARY STATS

• When using Active Secondaries, statistics are created in TempDB on the secondary replicas.o Database is exact replica so cannot have stats created in ito Workload is typically different to that of the primary

• Temporary Statistics will be lost on a SQL Server service restart.

Page 10: Always On Availability Group Maintenance Operations

TEMPORARY STATS

• New Maintenance job that we have not encountered beforeo Identify and collect details of temporary statistics on active secondaryo Process for applying to primary replica

• Automated processingo ! Caution ! Do not apply all temp stats to primaryo Gather to a location and review, approve for deployment

Page 11: Always On Availability Group Maintenance Operations

DEMOGathering and assessing Temporary Statistics.

Page 12: Always On Availability Group Maintenance Operations

DATABASE CONSISTENCY CHECKS• Important to understand that DBCC CHECKDB() needs to

be run on all replicas.o Each system has a unique storage platform that could have corruption

• Consistency Checks are part of corruption detectiono Use CHECKSUM page verification on databases o Monitor for 823, 824, 825 errorso DBCC CHECKDB()

• Important to make sure you monitor & manage dbo.suspect_pages in MSDB

Page 13: Always On Availability Group Maintenance Operations

DATABASE CONSISTENCY CHECKS

• Automatic Page Repair can only do so mucho Will not repair File Header (Page 0)o Will not repair Boot Page (Page 9)o Will not repair GMA/SGMA/PFS pages

• Have a process for handling the detection of corruption.o Script/Automate failover to a Secondary Replica in the event of a failed DBCC CHECKDB()

o Manual intervention

• Important to remember you cannot prevent corruption, but you can plan for it.

Page 14: Always On Availability Group Maintenance Operations

DATABASE CONSISTENCY CHECKS

• Secondary needs to be active (readable) for the CHECKDB to complete without errors.o An alternative is to create a snapshot on the Secondary Replica and execute

CHECKDB against that.

• Be wary of the impact this will have on the primary if the IO subsystem is shared.o Heavy IO Load on the data volumes can result in disk latency if using shared

controllers or HBAs for storage access.

Page 15: Always On Availability Group Maintenance Operations

RE-INDEXING OPERATIONS• AlwaysOn Availability Group Databases are in Full

Recovery Model – Fully Loggedo Generation of transaction log can be higho Online Index Operations can have a very high impact

• Important to use an intelligent re-indexing mechanismo Target only those that need to be re-indexed not allo Use thresholds for reorganization and rebuild

• When is this operation taking place?o Can impact RPO & RTO in the event of failover scenarios due to the amount of

log generatedo Do you have exclusive access to the database

Page 16: Always On Availability Group Maintenance Operations

RE-INDEXING OPERATIONS

• Can you make use of Asynchronous log transfer?o Log throughput can artificially throttle the re-indexing process with

synchronous transfer.o This will remove the ability to leverage auto-failover while the operation is

completing and as the replica becomes synchronized.

Set all replicas to

Asynchronous

Begin Re-indexing process

Return replicas to prior state (Sync/Async)

Verify replicas are

synchronized

Page 17: Always On Availability Group Maintenance Operations

RE-INDEXING OPERATIONS

• What about suspending log transfer?o Suspend data movement between replicas.o Bypasses the performance restrictions on transaction log throughput.

Suspend Data Movement on

Primary

Begin Re-indexing process

Resume Data Movement on

Primary

Verify log is sent and

replicas have caught up.

Page 18: Always On Availability Group Maintenance Operations

DEMORe-indexing operations with AlwaysOn Availability Groups

Page 19: Always On Availability Group Maintenance Operations

SYNCHRONIZE JOBS

• Important to understand job executiono Execution on primary or secondaryo Logic in the job or master process to enable/disable

• Which jobs need to be synchronizedo Make use of custom categories to help identify jobs

• Important to define synch process between replicaso Downstream from primary or from where the change was made?o How to handle conflicts?

Page 20: Always On Availability Group Maintenance Operations

SYNCHRONIZE JOBS

• Conflict detection is importanto Job Configuration Optionso Job Step configurationo Job Step body

• Methods of conflict detectiono Hash comparisono String comparisono Value comparisons

Page 21: Always On Availability Group Maintenance Operations

SYNCHRONIZE JOBS

• Jobs can have a lot of dependencieso Proxies, Credentials, Operatorso Schedules, Categories, Output Locations

• Optionso Manuallyo SSIS packageo PoSho T-SQLo Custom processo MSX Server

Page 22: Always On Availability Group Maintenance Operations

SUMMARY• Think about the logic behind the synchronization of logins

& jobs.

• How do you detect, review and handle conflicts between synchronized objects?

• Consistency Checks (CHECKDB) needs to be done on all replicas.

• Re-indexing is a balance between performance & impact to the system.

• Materializing temporary statistics can improve system performance.

Page 23: Always On Availability Group Maintenance Operations

QUESTIONS

Page 24: Always On Availability Group Maintenance Operations

THANK YOU!

• Slides will be available at http://blogs.sqlsentry.com • More information at:

o SQLSkills, et al• E-mail [email protected] for free copies of our e-books:

o Just tell them where you met me• My contact info for other questions:

o Email: [email protected] Twitter: @SQLServerMonkey