Date post: | 10-Apr-2017 |
Category: |
Technology |
Upload: | john-martin |
View: | 239 times |
Download: | 0 times |
ALWAYSON AVAILABILITY GROUP MAINTENANCE
OPERATIONS
Things you need to consider.
Tuning blog: http://www.sqlperformance.com/
E-mail [email protected] for free copies of our $10 e-books:
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
AGENDA• Introductions
• Maintenance Operations:o Synchronizing Loginso Statistics Maintenanceo Database Consistency Checkso Database Index Maintenanceo Synchronizing SQL Agent Jobs
• Summary
• Wrap Up
WHAT & WHY?
• SQL Server Maintenance Operations
• Impact of using AlwaysOn Availability Groups on common maintenance tasks.
• New maintenance tasks that you need to implement.
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.
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
DEMOSynchronizing SQL Server Logins between Availability Group
Replicas.
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.
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
DEMOGathering and assessing Temporary Statistics.
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
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.
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.
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
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
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.
DEMORe-indexing operations with AlwaysOn Availability Groups
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?
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
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
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.
QUESTIONS
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