A process and accompanying tools to make Index reorganization/rebuilding successful. Applicable on small databases and multi-Tb databases with over 20,000 tables (including examples of what can go horribly wrong without the right preparation). Bonus: PowerShell monitoring script included.
2. ABSTRACT
Dean will introduce a process and accompanying tools to make Index
reorganization/rebuilding successful. Applicable on small databases and multi-Tb
databases with over 20,000 tables (including examples of what can go horribly wrong
without the right preparation). Bonus: PowerShell monitoring script included.
3. AGENDA
Indexing - What can go wrong?
Process Overview
Pre-requisites (initial setup/configuration)
Pre-index preparation
Running Index optimization
Index progress monitoring (awesome PowerShell script)
5. WHAT COULD POSSIBLY GO
WRONG?
Lose your job BAD
Disk out of space
Tlog or Database files
Tlog backup files
Exponential Tlog growth
Temporarily pain
Tlog or database growth initialization causing application timeout
6. CONSIDERATIONS
Enterprise Edition
Online Index rebuild
Tlog auto-growth settings
% or size
Size planning
Full backups during re-index
Tlog will not truncate during a full backup even if log backups are being taken
Big database (4 hr backup + recovery) use differentials during re-index?
TODO: Add log_reuse_wait_desc to Powershell monitoring tool when log used percent is >
warning threshold.
Re-Index vs. Re-Organize
MaxDOP?
TempDb
14. SP_WHOISACTIVE
Adam Machanics sp_WhoIsActive script is a new and improved version of sp_who2
http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx
Shows current connections, % progress of index re-organization, and much more
20. PRE-INDEX PREPARATION FOR VLDB
Tlog backup schedule
Shorten duration
Full backup schedule
Temporarily switch to differential backups
Open monitoring tools or schedule the Sweet Powershell script
24. INDEX MONITORING OLD SCHOOL
DMV Disk Usage
Windows Explorer .trn backup file sizes
Windows Explorer tlog backup duration
sp_who2
25. INDEX MONITORING LIKE A BOSS
Powershell Script
sp_WhoIsActive (by Adam Mechanic)
Queries
Completed indexes
Current index rebuild progress (%, rows remaining)
Current index reorg progress (%)
Disk space used (Database files and Tlog
Tlog backup size and backup duration
Windows Scheduler
Email
26. TLOG ABOUT TO GROW
Transactions are paused while TLOG file
is growing
Truncation should prevent growth
depending on initial size
Autogrowth settings
29. TLOG BACKUP DURATION
Durations shown in the query dont
include the WithVerify time
I usually use a 3X multiplier for
estimating actual tlog backup time
Look at start time of next backup
31. WARNING SIGNS
VLDB data file about to grow
TLOG file about to grow
TLOG backup duration + Verify taking
longer than backup schedule schedule
Log file not truncating (excessive
growth)
Wait times on sp_WhoIsActive
File sizes growing larger than available
disk space
32. DEAN WILLSON
Director of Application Development, Aunt Millies Bakeries
Long time member of NUFW
Former President of fwPASS
Twitter: @deanwillson
Blogs: dean-o.blogspot.com, practicalhoshin.blogspot.com
LinkedIn: http://linkedin.com/in/deanwillson