62
SharePoint and the Involuntary DBA COM715 Thomas Vochten

SharePoint and the involuntary DBA

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: SharePoint and the involuntary DBA

SharePoint and the Involuntary DBA

COM715

Thomas Vochten

Page 2: SharePoint and the involuntary DBA

Thomas Vochten

@thomasvochten thomasvochten.com [email protected]

SharePoint consultant. Platform architect. Speaker. Trainer. Accidental DBA.

Page 3: SharePoint and the involuntary DBA

Agenda

SharePoint & SQL Server SQL Server Fundamentals Preparing the platform Performing a deliberate installation Real world configuration tips Operational guidance Useful tools & resources

Page 4: SharePoint and the involuntary DBA

I’m not a professionally trained DBA

Page 5: SharePoint and the involuntary DBA

Meet the involuntary DBA

Someone who is made to assume a DBA role or take on DBA responsibilities, usually

against their will (*)

(*) Paul Randal

Page 6: SharePoint and the involuntary DBA

The Dynamic Duo

SharePoint & SQL Server

Page 7: SharePoint and the involuntary DBA

Importance to SharePoint

SharePoint performance impact Almost everything is stored in SQL Support for your HA/DR strategy

Page 8: SharePoint and the involuntary DBA

SharePoint 2013

Many schema optimizations Reduced IO operations Distributed Cache Shredded Storage

Page 9: SharePoint and the involuntary DBA

Shredded Storage

Evolution from SharePoint 2010 Document is stored as separate BLOB’s

in SQL Server Only changed BLOB’s will be sent back to

SQL Server Reduced IO & Storage needs

Page 10: SharePoint and the involuntary DBA

Database, anyone?

A lot of SharePoint databases Each with different needs

Page 11: SharePoint and the involuntary DBA

Limits & boundaries

Content database sizing

200 GB still the sweet spot 4 TB if you know what you’re doing … or even unlimited

Page 12: SharePoint and the involuntary DBA

Limits & boundaries

Content database limits

500 content databases per farm 60 million items in a content database 10.000 site collections in a content

database*

* 5000 is recommended

Page 13: SharePoint and the involuntary DBA

Supported Versions of SQL

SQL Server 2012 x64 SQL Server 2008 R2 Service Pack 1 x64

Editions supported:Standard, Enterprise, Datacenter

Page 14: SharePoint and the involuntary DBA

SharePoint makes DBA’s cry

Unconventional practices Support policy GUIDS all over the place

Page 15: SharePoint and the involuntary DBA

Get rid of the GUID

Grey wizard

GOOD

White wizard

BAD

Page 16: SharePoint and the involuntary DBA

PowerShell to the rescue

New-SPConfigurationDatabase AutoSPInstaller Naming convention matters!

http://autospinstaller.codeplex.com

Page 17: SharePoint and the involuntary DBA

SQL Server Fundamentals

Page 18: SharePoint and the involuntary DBA

SQL Server Storage Primer

Use of 8K pages in data files Use of 64K as basic unit of space Database files (.mdf) & Log files (.ldf) Indexes

Page 19: SharePoint and the involuntary DBA

SQL Server databases

System databases

master, model, msdb, tempdb

User databases (SharePoint)

config, content, search, …

Page 20: SharePoint and the involuntary DBA

TempDB

Give it proper care Initial sizing Number of data files Dedicated drive Tune autogrowth

Page 21: SharePoint and the involuntary DBA

Recovery Models

Essential reading:

Understanding Logging & Recovery

http://technet.microsoft.com/en-us/magazine/2009.02.logging.aspx

Simple recovery model - last full backup Full recovery model - up to the minute

Page 22: SharePoint and the involuntary DBA

Simple or full

“Why does this log file grow forever?”

Page 23: SharePoint and the involuntary DBA

Demo

CONTROL LOG FILE GROWTHLearning about the full recovery mode

Page 24: SharePoint and the involuntary DBA

Simple or full

“Why does this log file grow forever?”

Full recovery model requires log backups

Page 25: SharePoint and the involuntary DBA

Preparing the platform

Page 26: SharePoint and the involuntary DBA

General considerations

SQL is all about mem/disk IO/cpu Dedicate a SQL instance to SharePoint Virtualizing SQL Server?

Page 27: SharePoint and the involuntary DBA

Plan your disks

Differentiate & prioritize based on IO needs

1. tempdb

2. logs

3. search

4. other databases

Page 28: SharePoint and the involuntary DBA

Prepare your disks

Check/modify:

Up to 50% io performance gains measured!

Partition alignment 1024K everywhere

Allocation unit size 64K for SQL data & logs

Page 29: SharePoint and the involuntary DBA

diskpart

list disk

select disk <DiskNumber>

create partition primary align=1024

assign letter=<DriveLetter>

format fs=ntfs unit=64K label="<label>" nowait

Prepare your disks

Page 30: SharePoint and the involuntary DBA

Prepare your disks

Test the disks you get offered Sqlio to the rescue (or even

CrystalDiskMark)

Page 31: SharePoint and the involuntary DBA

Demo

PREPARE YOUR DISKSPartition alignment & allocation unit size

Page 32: SharePoint and the involuntary DBA

Deliberate Installation

Page 33: SharePoint and the involuntary DBA

Running Setup

Only install the features you need Use domain user as service account Don’t lock out other admins Configure data & log file placement Set the right collation:

Latin1_General_CI_AS_KS_WS

Page 34: SharePoint and the involuntary DBA
Page 35: SharePoint and the involuntary DBA
Page 36: SharePoint and the involuntary DBA
Page 37: SharePoint and the involuntary DBA
Page 38: SharePoint and the involuntary DBA

Patching SQL Server

Service Pack Cumulative Updates

Page 39: SharePoint and the involuntary DBA

Post setup

Enable instant file initialization

Speeds up data file creation enormously Disables zeroing out data files Does not work for log files Set “Perform volume maintenance tasks”

Page 40: SharePoint and the involuntary DBA

Demo

INSTANT FILE INITIALIZATIONSpeeding up your data file operations

Page 41: SharePoint and the involuntary DBA

Configuration Tips

Page 42: SharePoint and the involuntary DBA

Don’t forget

Start SQL Server Agent Set up alerting for specific events Don’t forget about Windows Firewall

(open port 1433)

Page 43: SharePoint and the involuntary DBA

Instance level settings

Determine maximum memory Set fill factor to 80 Turn on backup compression Set MAXDOP to 1

Page 44: SharePoint and the involuntary DBA

Setting MAXDOP is now mandatory in SharePoint 2013

Page 45: SharePoint and the involuntary DBA

Database level settings

Consider multiple data files Tune autogrowth settings Presize databases Recovery model (simple or full) Read-only databases

Page 46: SharePoint and the involuntary DBA

Connecting SharePoint to SQL

Use SQL aliases for added flexibility Test your connection beforehand Grant the correct rights to the setup

account (dbcreator, securityadmin)

Page 47: SharePoint and the involuntary DBA

Demo

CONFIGURATION TIPSSQL Agent, Instance & Database level settings, Aliases

Page 48: SharePoint and the involuntary DBA

Operational Guidance

Page 49: SharePoint and the involuntary DBA

Required Reading

KB841057 supported & unsupported actions to databases

Database Maintenance for SharePoint 2010 Products

* Still relevant for SharePoint 2013

Page 50: SharePoint and the involuntary DBA

Regular maintenance

Check database integrity (dbcc checkdb) Check index fragmentation Learn about maintenance plans

Page 51: SharePoint and the involuntary DBA

Index fragmentation

Check “sys.dm_db_index_physical_stats”Illustration by Paul Randal

* Illustration by Paul Randal

Page 52: SharePoint and the involuntary DBA

Reducing fragmentation

SharePoint Health Analyzer Perform index rebuild manually Set the fill factor to 80

Consider rebuilding indexes when fragmented over 30% (for content

databases)

Page 53: SharePoint and the involuntary DBA

Watch out for the shrink

Just because you can,

doesn’t mean you should

Causes massive fragmentation Rebuild indexes & keep free space Autoshrink is the root of all evil!

Page 54: SharePoint and the involuntary DBA

Demo

OPERATIONAL GUIDANCEDatabase maintenance and the danger of shrinking

Page 55: SharePoint and the involuntary DBA

Tools & Resources

Page 56: SharePoint and the involuntary DBA

Database Maintenance

Invaluable scripts for backup & consistency checks

http://ola.hallengren.com/

Page 57: SharePoint and the involuntary DBA

Counter Intelligence

Blitz! scripts by Brent Ozar

http://brentozar.com/blitz

Diagnostic scripts by Glenn Berry

http://sqlserverperformance.wordpress.com/

PAL Tool

http://pal.codeplex.com

Page 58: SharePoint and the involuntary DBA

Demo

COUNTER INTELLIGENCEUsing scripts to quickly assess the health of a SQL Server

Page 59: SharePoint and the involuntary DBA

Tuning SQL Server 2012 for SharePoint 2013 Jump Start

4 hours of video by Bill Baer & Brian Alderman

https://www.microsoftvirtualacademy.com/training-courses/tuning-sql-server-2012-for-sharepoint-2013-jump-start

Page 60: SharePoint and the involuntary DBA

ResourcesWhere do I go for SQL help?

Paul Randal (blog | twitter)

Kimberly Tripp (blog| twitter)

Brent Ozar (blog| twitter)

Glenn Berry (blog| twitter)

Fancy some blogs?

http://thomaslarock.com/rankings

Get help – fast!

#sqlhelp on Twitter

Page 61: SharePoint and the involuntary DBA

Key Takeaways

Know limits & boundaries Understand logging & recovery Plan disk layout & configuration Enable instant file initialization Use PowerShell for more control Tune instance & database settings Use SQL aliases Check for consistency (weekly)

Page 62: SharePoint and the involuntary DBA

Thank you for attending!

@thomasvochten