SharePoint - From Denial to Acceptance

75
SQL SERVER DAYS 2013 SHAREPOINT FROM DENIAL TO ACCEPTANCE THOMAS VOCHTEN

description

Remember the day your boss pulled you aside for what seemed a friendly chat? “Oh, there’s one more thing… We’re getting SharePoint.” You probably had to run to the shower to wash off the dirty feeling – but hey, it isn’t so bad you know. In this session we’ll explore the ins and outs of SharePoint for DBA’s. Why does SharePoint likes to do things its own way? What can and can’t you do to SharePoint databases? What SharePoint specific settings do you have to know about? How to maintain SharePoint databases without ruining it with Microsoft support?

Transcript of SharePoint - From Denial to Acceptance

Page 1: SharePoint - From Denial to Acceptance

SQL SERVER DAYS 2013

SHAREPOINT

FROM DENIAL TO ACCEPTANCE

THOMAS VOCHTEN

Page 2: SharePoint - From Denial to Acceptance

ABOUT ME

• SharePoint MVP• SQL Server enthousiast• Platform architect • Trainer

@thomasvochtenhttp://thomasvochten.comhttp://linkedin.com/in/thomasvochten

Page 3: SharePoint - From Denial to Acceptance

AGENDA

• Introducing SharePoint & SQL• Planning for SharePoint• Setup Good Practices• Maintenance Tasks• Backup & Restore• High Availability & Disaster Recovery

Page 4: SharePoint - From Denial to Acceptance

CONFESSIONS

Page 5: SharePoint - From Denial to Acceptance

I’M NOT A REAL DBA

Page 6: SharePoint - From Denial to Acceptance

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 7: SharePoint - From Denial to Acceptance

WHY ARE WE TALKING ABOUT SHAREPOINT?

• It’s everywhere! Used by 80% of the Fortune 500• Microsoft’s fastest selling server product• Importance of SQL for SharePoint is huge• Many frustrations among SQL Server professionals

Page 8: SharePoint - From Denial to Acceptance

WHICH FRUSTRATIONS?

• The support policies• The strange schema• The database settings• The default database names• The server rights they ask for• The unconventional maintenance practices• The GUID’s all over the place• SharePoint likes to create its databases itself• …

Page 9: SharePoint - From Denial to Acceptance

ABOUT SHAREPOINT & SQL

The Dynamic Duo

Page 10: SharePoint - From Denial to Acceptance

SHAREPOINT 2007

Page 11: SharePoint - From Denial to Acceptance

SHAREPOINT 2010

Page 12: SharePoint - From Denial to Acceptance

SHAREPOINT 2013

Page 13: SharePoint - From Denial to Acceptance

DATABASES VS SHAREPOINT VERSIONS

SharePoint Foundation

SharePoint Standard

SharePoint Enterprise

Page 14: SharePoint - From Denial to Acceptance

SHAREPOINT - THE LEGACY

• Database schema concept goes way back• Every SharePoint update modifies the schema!• The newer the version, the more databases• Many improvements with SharePoint 2013• What is stored inside SQL Server?

Page 15: SharePoint - From Denial to Acceptance

THE SHAREPOINT OBJECT HIERARCHY

• Farm• Service Applications• Service Application Databases• Servers• Web applications• Content Databases• Site collections• Sites• Lists• Items

Page 16: SharePoint - From Denial to Acceptance

SITES AND THEIR DATABASES

Site Collectionhttps://intranet.contoso.com

Content Database

Subsite

SharePoint Farm

Web Applicationhttps://intranet.contoso.com

Web Applicationhttps://extranet.contoso.com

Content Database

Content Database

Other Databases

Site Collectionhttps://intranet.contoso.com/projects/1

Site Collectionhttps://intranet.contoso.com/customers/1

Subsite

Subsite

Page 17: SharePoint - From Denial to Acceptance

CONTROLLING CONTENT DATABASE SIZE

• Site collection can only live in 1 content database• Balance site collections across content databases• Use site collection quota’s to control growth and size

Page 18: SharePoint - From Denial to Acceptance

DATABASE, ANYONE?

• A lot of SharePoint databases• Each with different needs

Page 19: SharePoint - From Denial to Acceptance

THE (ALMOST) DEFINITIVE LIST

• Configuration Database• Central Administration

Content Database• Content Database• App Mgmt Database• Business Connectivity

Services Database• Search Administration

Database• Analytics Reporting Database• Crawl Database• Links Database

• Secure Store Database• Usage Database• Subscription Settings

Database• Profile Database• Synchronization Database• Social Database• Word Automation Database• Managed Metadata Database• Machine Translation Database• PerformancePoint Database• State Service Database

Page 20: SharePoint - From Denial to Acceptance

DATABASE TYPES

Configuration Database 1

Service Application Databases Multiple

Content Databases Multiple

Page 21: SharePoint - From Denial to Acceptance

DATABASES WITH SPECIAL NEEDS

IOPS intensive databases in a SharePoint environment:

• TempDB• Logging database• Search databases

> Effect on storage planning!

Page 22: SharePoint - From Denial to Acceptance

SAY WHAT?

Page 23: SharePoint - From Denial to Acceptance

GET RID OF THE GUID

Grey wizardGOOD

White wizardBAD

Page 24: SharePoint - From Denial to Acceptance

POWERSHELL TO THE RESCUE

• New-SPConfigurationDatabase• AutoSPInstaller• Naming convention matters!

http://autospinstaller.codeplex.com

Page 25: SharePoint - From Denial to Acceptance

NEW WITH SHAREPOINT 2013

• Many schema optimizations• Reduced IO operations• Distributed Cache• Less need for the dbo role• Sparse columns• Shredded Storage

Page 26: SharePoint - From Denial to Acceptance

SHREDDED STORAGE

• Performance & Sizing impact• SharePoint feature• Evolution from the Cobalt protocol in 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 27: SharePoint - From Denial to Acceptance

PLANNING FOR SHAREPOINT

Page 28: SharePoint - From Denial to Acceptance

IMPORTANCE TO SHAREPOINT

• SharePoint performance impact• Almost everything is stored in SQL

Page 29: SharePoint - From Denial to Acceptance

LIMITS & BOUNDARIES

Content database sizing revisited

General purpose 200 GB

Controlled < 4 TB

Structured > 4 TB

Page 30: SharePoint - From Denial to Acceptance

ESTIMATE CONTENT DATABASE SIZE

• ((D × V) × S) + (10 KB × (L + (V × D)))

- Number of documents (D)- Average size of documents (S)- List items (L)- Number of non-current versions (V)

Page 31: SharePoint - From Denial to Acceptance

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 32: SharePoint - From Denial to Acceptance

SUPPORTED VERSIONS OF SQL

For SharePoint 2013

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

Editions supported:

• Express, Standard, Enterprise, Datacenter

Page 33: SharePoint - From Denial to Acceptance

SHAREPOINT BENEFITS WITH SQL ENTERPRISE

• Online index rebuilds• Availability Groups• Transparent Data Encryption• Table Partitioning• Snapshots• Remote BLOB Storage• Resource Governor• PowerPivot• …

Page 34: SharePoint - From Denial to Acceptance

SQL SYSTEM REQUIREMENTS WITH SHAREPOINT

• CPU

64 bit, 4 cores for small deployments64 bit, 8 cores for medium deployments

• Memory

8 GB for small deployments16 GB for medium deployments

Page 35: SharePoint - From Denial to Acceptance

VIRTUALIZATION

Supported for SharePoint across the board

Best Candidates Web ServersLightweight Application Severs

Good Candidates Search Application Servers

Possible Candidates SQL Servers

Page 36: SharePoint - From Denial to Acceptance

PLAN YOUR DISKS

Differentiate & prioritize based on IO needs

1. tempdb2. logs3. search4. other databases

Page 37: SharePoint - From Denial to Acceptance

SETUP GOOD PRACTICES

Page 38: SharePoint - From Denial to Acceptance

DISK PREPPING

The usual suspects…

• Partition alignment (1024K)• NTFS cluster sizes (64K)• TempDB importance• SQLIO to the rescue!

Page 39: SharePoint - From Denial to Acceptance

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”

Not only for SharePoint!

Page 40: SharePoint - From Denial to Acceptance

INSTANCE PREPPING

• Latin1_General_CI_AS_KS_WS collation• MAXDOP must be set to 1• FILL FACTOR to 80% (for 2007 or 2010 only)• Use a domain account as service account• Set MAXMEM• Dedicated instance for SharePoint• SharePoint only needs the database engine• Don’t forget to start SQL Agent• Enable backup compression

Page 41: SharePoint - From Denial to Acceptance

MEMORY

Page 42: SharePoint - From Denial to Acceptance

DATABASE SETTINGS

Page 43: SharePoint - From Denial to Acceptance

ADVANCED (MAXDOP)

Page 44: SharePoint - From Denial to Acceptance

MAXDOP TO 1 IS MANDATORY IN 2013

Page 45: SharePoint - From Denial to Acceptance

DATABASE TUNING

• Multiple database files per database• Realistic autogrowth settings, don’t use %• Choose your recovery model wisely• SharePoint supports read-only content databases• Pregrow database & log files

Page 46: SharePoint - From Denial to Acceptance

OPTIONS

Page 47: SharePoint - From Denial to Acceptance

PERMISSIONS

SharePoint setup/admin user needs:

• dbcreator• securityadmin

Why do SharePoint admins ask for sysadmin role membership?

Page 48: SharePoint - From Denial to Acceptance

PRE-CREATING DATABASES

• By default, SharePoint creates its own databases• DBA’s can pre-create databases for more control• Latin1_General_CI_AS_KS_WS collation for SharePoint

What do you do after the farm has been created?

Page 49: SharePoint - From Denial to Acceptance

SHAREPOINT’S WAY - OR MORE FRUSTRATIONS

• Auto Create Statistics = off• Auto Update Statistics = off• GUIDS as clustered indexes• No referential integrity• Model Database is not used by SharePoint

Page 50: SharePoint - From Denial to Acceptance

SQL ALIASES

• Use SQL Aliases to connect SharePoint to SQL Server• Use multiple aliases for different database types:

core databasescontent databasessearch databaseslogging database

Page 51: SharePoint - From Denial to Acceptance

WORK WITH YOUR SHAREPOINT PEOPLE

• Naming conventions• Precreation of databases• Site collections placement• Impact of SharePoint creating databases:

backupsHA & DR techniquesnaming conventionsdatabase options

Page 52: SharePoint - From Denial to Acceptance

DEMO

Anatomy of a SharePoint database system

Page 53: SharePoint - From Denial to Acceptance

MAINTENANCE TASKS

How not to ruin it with Microsoft support

Page 54: SharePoint - From Denial to Acceptance

REQUIRED READING

• KB841057 supported & unsupported actions to databases

• Database Maintenance for SharePoint 2010 Products

* Still relevant for SharePoint 2013 and SQL Server 2012

Page 55: SharePoint - From Denial to Acceptance

DON’T

• Adding database triggers• Adding new indexes or changing existing indexes within tables • Adding, changing, or deleting any primary or foreign key relationships • Changing or deleting existing stored procedures • Calling existing stored procedures directly• Adding new stored procedures • Adding, changing, or deleting any data in any table of any of the databases• Adding, changing, or deleting any columns in any table• Making any modification to the database schema • Adding tables to any of the databases• Changing the database collation • Running DBCC_CHECKDB WITH REPAIR_ALLOW_DATA_LOSS• Enabling SQL Server change data capture (CDC)• Enabling SQL Server transactional replication• Enabling SQL Server merge replication

Page 56: SharePoint - From Denial to Acceptance

DO

• Operations that are initiated from the SharePoint administrative user interface• SharePoint specific tools and utilities that are provided

directly by Microsoft (PowerShell)• Changes that are made programmatically through the

SharePoint Object Model and that are in compliance with the SharePoint SDK documentation• Activities that are in compliance with the SharePoint

Protocols documentation

Page 57: SharePoint - From Denial to Acceptance

REDUCING FRAGMENTATION

• SharePoint Health Analyzer checks

configuration databasecontent databasessome application databases

• Perform index rebuild manually• Consider rebuilding indexes when fragmented over 30%• SharePoint uses a non-default Fill Factor• Not all databases are checked by SharePoint however• AllDocs table is the most likely candidate• SQL Enterprise for online index rebuild (<> table locks)• Offline rebuild for many tables anyhow (BLOB’s)

Page 58: SharePoint - From Denial to Acceptance

HEALTH ANALYZER RULES & STORED PROCEDURES

• Databases used by SharePoint have fragmented indices

exec proc_DefragmentIndices (trigger is 30%)

• Search - One or more crawl databases may have fragmented indices

exec proc_MSS_DefragGathererIndexes (trigger is 10%)

• Some content databases are growing too large• Database has large amounts of unused space• Databases used by SharePoint have outdated index statistics

Page 59: SharePoint - From Denial to Acceptance

MANAGE INDEXES MANUALLY

DO ALTER INDEX

DON’T DROP INDEXCREATE INDEX

Examples:

ALTER INDEX AllDocs_Url ON dbo.AllDocsREBUILD WITH (ONLINE=ON) GO

ALTER INDEX tp_SiteId ON dbo.AllListsREORGANIZE GO

Page 60: SharePoint - From Denial to Acceptance

WATCH OUT FOR THE SHRINK

Just because you can, doesn’t mean you should

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

Can be considered after special SharePoint operations like moving a site from one database to another

Page 61: SharePoint - From Denial to Acceptance

CHECK FOR CONSISTENCY

• Run DBCC CHECKDB regularly• WITH REPAIR_FAST & WITH_REPAIR_REBUILD is supported• WITH REPAIR_ALLOW_DATA_LOSS is not supported• WITH PHYSICAL_ONLY on very demanding environments

Page 62: SharePoint - From Denial to Acceptance

BACKUP & RESTORE

Page 63: SharePoint - From Denial to Acceptance

BACKING UP SHAREPOINT

• Backup all databases frequently• Content databases are the most important ones• File system backups are still needed• Simple or Full recovery model

Page 64: SharePoint - From Denial to Acceptance

FRUSTRATIONS… AGAIN!

• Configuration database cannot be restored• SharePoint built-in backups may break the backup chain!

does a normal full backupdoes not do WITH COPY_ONLY

Know what goes on in your environment

Page 65: SharePoint - From Denial to Acceptance

HIGH AVAILABILITY & DISASTER RECOVERYHow to support SharePoint availability with SQL Server

Page 66: SharePoint - From Denial to Acceptance

SHAREPOINT HIGH AVAILABILITY SUPPORT

• Clustering• Synchronous mirroring• Availability Groups synchronous commit

General rule of thumb:Synchronous for HA, supported with most databases

Page 67: SharePoint - From Denial to Acceptance

SHAREPOINT DISASTER RECOVERY SUPPORT

• Log Shipping• Asynchronous mirroring• Availability Groups asynchronous-commit mode

General rule of thumb:Asynchronous for DR, supported with some databases

Page 68: SharePoint - From Denial to Acceptance

TYPICAL IMPLEMENTATION

Page 69: SharePoint - From Denial to Acceptance

TAKEAWAYS

• SharePoint is what it is, don’t try to change it• Work with your SharePoint administrators• Be aware of the limits & boundaries• Know what is supported and what not• Get involved when they are planning SharePoint!

Page 70: SharePoint - From Denial to Acceptance

KEY RESOURCES

Best practices for SQL Server in a SharePoint Server farmhttp://technet.microsoft.com/en-us/library/hh292622.aspx

Storage and SQL Server capacity planning and configurationhttp://technet.microsoft.com/en-us/library/cc298801.aspx

Overview of SQL Server in a SharePoint environmenthttp://technet.microsoft.com/en-us/library/ff945791.aspx

Support for changes to the databases that are used by SharePointhttp://support.microsoft.com/kb/841057

Database maintenance for SharePoint http://technet.microsoft.com/en-us/library/cc262731.aspx

Supported high availability and disaster recovery options for SharePoint databases

http://technet.microsoft.com/en-us/library/jj841106.aspx

Page 71: SharePoint - From Denial to Acceptance

JUMPSTART

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 72: SharePoint - From Denial to Acceptance

BIWUG

SharePoint User Groupwww.biwug.be

Page 73: SharePoint - From Denial to Acceptance

Q & A

#sqlserverdays@thomasvochten

Page 74: SharePoint - From Denial to Acceptance
Page 75: SharePoint - From Denial to Acceptance

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.