+ All Categories
Home > Technology > SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Date post: 11-Aug-2015
Category:
Upload: mark-broadbent
View: 178 times
Download: 0 times
Share this document with a friend
30
Mark Broadbent Principal Consultant SQLCloud SQLCLOUD.CO.UK SQL Server is from Venus
Transcript
Page 1: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Mark Broadbent

Principal Consultant

SQLCloud

SQLCLOUD.CO.UK

SQL Server

is from Venus

Page 2: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Disclaimer

• I am not a SharePoint Professional (yet)

• This session is not about SharePoint

• This is not a comprehensive introduction

• There is a danger that you might end up becoming a DBA

Page 3: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Why you should stay

• Many of the SharePoint considerations are counter intuitive which means that:• Your DBA hates you (he always has and always will)

• Dedicated SharePoint Farm SQL Servers are required

• Your DBA is (sometimes) an idiot• But it is not always his fault

• He only speaks T-SQL and doesn’t understand SharePoint

• You can communicate with him better

Page 4: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

About

Mark Broadbent.“30 billion times more intelligent than a live mattress”Microsoft Certified Master/ Certified Solutions Master: SQL Server

Owner/ Principal at SQLCloud

Email: [email protected]

Twitter: retracement

Blog: http://tenbulls.co.uk

Event Lead to the UK’s first ever SQLSaturday (Cambridge)

– now also SharePoint Saturday

Event #3 on 10/ 11/ 12th Sept 2015 (pre-cons & Community day)

http://sqlcambs.org.uk

Page 5: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Agenda

Installation

1

Databases and internals

2

Memory, CPU and Connectivity

High Availability

The best part of the presentation… SharePint

4

3

5

Page 6: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

What *exactly* is SQL Server?

• High performance structured relational database engine

• Complex suite and engine provides its own (internal) operating system (SQLOS)!

• Optimised to reduce IO

• Intelligent Query Optimisation

• Provides ACID based transactional processing

• Offers highly available solutions AND is also Cluster Aware

Page 7: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Pre-Installation Considerations

• Which versions of Windows and SQL Server?

• Server Collation (consider Latin1_General_CI_AS_KS_WS )• Content Database default

• Cannot change post install

• Problematic for shared environments (TempDB conflicts)

• File placement of system databases• Aim to place System DBs correctly at installation time

• TempDB can be easily moved post install

• Requires restart

• If you get it wrong SQL wont start (run in single user mode)

• Format storage using 64K cluster size including RAID stripe

• Dedicated SQL installation• Clustered or standalone –co-existance considerations?

Page 8: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Page 9: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Open file and saveOpen file and save

Page 10: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

• Standalone only, for Clusters use Command line for unattended

Page 11: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Run installer on Full-Fat Edition (full build).Step through wizard (do not complete).Grab ConfigurationFile.ini from file path.

1

From Zero to Core Configuration File

Deploy core ready installation to Windows Server Core via command line

setup.exe /CONFIGURATIONFILE=“ConfigurationFile.ini” /QS

4

Replace Features with core compatible ones.Remove all lines below this line.

2

FEATURES=SQLENGINE,REPLICATION,FULLTEXT,AS,CONN,IS

“Install based on configuration file” on Full-Fat Edition.

Use configuration file modified in step 2.

3

Remove UIMODE="Normal“Add SAPWD=“{password}“and any other account passwords

Page 12: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Page 13: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Post Installation Considerations

• MAXDOP 1

• Max Mem (default is 2147483647) / OS reservation –Approx 2GB

• Page File Size (NOT 1.5x your memory! Page File usage is key)

• TempDB• Location

• Files, growth

• Fill factor to 80% to avoid page splits

• Default Paths for Log, Data and Backup

• Default Backup Compression turned on

• Traceflags, TCP/IP (+ Port)

Page 14: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Databases

• Add multiple data files

• Set equal size (proportional fill algorithm)

• Consider TF1117 (forces all files to grow)

• Ensure Instant file initialisation is switched on• Only works for data files• Add SQL Service account to “Perform volume

maintenance tasks” group policy

• Use Quota Templates for your site collections

Master (SQL server schema and meta data)

Msdb (SQL Server Agent job repository

Resourcedb (read only copy of system objects)

Model (default template for all new databases

Tempdb (public toilet of SQL Server and prone to page allocation contention PFS, GAM, SGAM)

Search

Content DBs

Page 15: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Transaction Log Architecture

Log file (.ldf)

Virtual Log Files (VLFs)

Log growth size <=64MB then 4 VLFs> 64MB AND <= 1GB 8 VLFs > 1GB 16 VLFSThink about how big your log needs to be from the beginning

Log Buffer 1

Log Buffer n

Log Writer

Signal to flush

Log writes are first written to log buffers. Flush on fill or on commit.

async

Control returned to spid on commit.

Page 16: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Pages

• Single logical unit of data storage in SQL Server

• Are 8 KB (or 8192 Bytes) in size

• Have 96-byte page header & row offset (or slot array) of 36 bytes

• Page row capacity is 8192-96-36 = 8060 bytes

• Different types including:• Index Pages

• Data Pages

• Allocation Pages

Page 17: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Extents and Files

• 8 physically contiguous pages (totalling 64 KB)

• Extents can be:• Mixed (default) – and shared up to 8 different objects

• Only for objects (index or table) < 8 pages

• Turned off using TF1118

• Uniform – owned entirely by single object

• One or more files can belong to filegroup. *1 A object (table or index) only exists within single filegroup

*1 SharePoint does not support using secondary filegroups

Page 18: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Buffer Cache

BEGIN TRANUPDATE

ordersSET qty = 10WHERE …

2

1

spid 115

BEGIN TRANINSERT order

(id,qty) VALUES (8,10)INSERT order

(id,qty) VALUES (9,2)COMMIT

spid 162

changes (IO) to pages in buffer cache first regardless of commit

Datafile

“dirty” pages in buffer cache flushed to disk on CHECKPOINT (but not removed from cache)

AutomaticCHECKPOINT

MAX MEMORY

Page 19: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Connectivity

• Default instance on 1433 by default

• Browser service (if enabled listens on 1434tony\sql01

TCP Port 9561

registry

SharePoint Farm

Group Policy

32 bit and 64 bit client aliases

tony\sql01resolves through alias

DNS Aliases

tonyresolves through aliasBrowser service required to resolve instance port number

spfarm1

spfarm1\sql01

Page 20: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Scheduling (think CPU)

SPID 71

SPID 80SPID 81SPID 85

SPID 100SPID 150

SPID 80 LCK_M_XSPID 81 NETWORKIOSPID 85 CXPACKETSPID 100 CXPACKETSPID 150 CXPACKET

Running – Scheduler 1

Runnable Queue– Scheduler 1Wait type: Signal Wait

Waiter ListWait type: Resource specific

On resource wait

resource wait complete

sys.dm_os_waiting_tasks

Cumulative waitstats found in sys.dm_os_wait_stats

Page 21: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Max Degree of Paralellism (MAXDOP)

• exec sp_configure ‘max degree of parallelism’ 0;

• So ‘cost threshold for parallelism’ can be ignored

• Statistics determine estimations which determine cost (which determines parallelism)

Page 22: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Database Backup and Recovery

• Full or differential backups do not “reseed” (or break) backup chain

• Differential all changes since last full

• Full resets differential bitmap (not on COPY_ONLY)

• Restore starts with a Full (or Primary Filegroup backup)

Full DiffFULL RECOVERY

Diff tran tran Diff Fulltran tran

SIMPLEFull Diff Diff Diff Full Full

Bulk Logged recovery has no use for SharePoint

• Ensure database recovery model matches database point in time requirements. Is that content database important?

Page 23: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Backup best practices

• Ensure backups on remote storage (RAID 5 is fine)

• Ensure compression is used• EXEC ‘backup compression default’,1; --set a server wide default

• BACKUP DATABASE <database> WITH COMPRESSION…. –per statement

• Run regular transaction log backups to truncate your VLFs

• Ensure page checksums are enabled

• Use WITH CHECKSUM on all backup and restore operations• Creates and validates backup stream checksum

• (If exist)page checksums validated AND backup stream checksum validated)

Page 24: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Supported Upgrade Path

• SharePoint 2013 supports 2008R2 and above

• Upgrade can be performed “in place” or to upstream instance

• Database upgrade steps run on RESTORE WITH RECOVERY• Use manual backups, Log

Shipping or Database Mirroring

SQL 2005 SP4

SQL 2008R2SP1

SQL 2012

SQL 2008 SP2

SQL 2000

Requires staged

Upgrade to SQL 2005,

SQL 2008 /R2

SQL 2014

Page 25: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

SharePoint 2013 Database HA Solutions

Manual backups, log shipping and Database Mirroring are perfect to assist with SharePoint DB upgrades

Log-shippingTransaction HA

Availability GroupsDatabase(s) level HA

Database MirroringDatabase level HA

Failover ClusteringSQL Instance HA

Page 26: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Cluster Quorum

• Windows Clusters required by SQL FCI and AGs

• By default one node casts one vote

• Voting disk/ Voting Share adds one vote (up to Windows 2012)

• Majority requires a visible count > Vote Maximum/ 2

• Windows 2012 and Windows 2012 R2 Maximum is dynamic

“I can see dead peopleX votes”

Lost connectivityto other nodes

Page 27: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Quorum Models and Functionalilty

Quorum determines if a node can be considered “alive” in a cluster

• Windows 2008/ R2 provides:• Disk Only Quorum (or No Majority)

• Node Majority (or Majority Node Set)

• Node and Disk Majority

• Node and File Share Majority

• Node Weighting via hotfix KB2494036

• Windows 2012 added Dynamic Quorum + Wizard vote assignment

• Windows 2012 R2 added: (THE reason for adoption)• Dynamic Witness Weight

• Split brain protection (or Tie Breaker) for 50% split

• Force quorum resiliency

Page 28: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Other best practices in case I forgot to say!

• Dedicated server instance

• Set max mem –min mem also important (especially when LPIM used)

• Avoid shrinking databases –unless you like fragmention!

• DBCC CHECKDB REPAIR_ALLOW_DATA_LOSS is unsupported use instead REPAIR_REBUILD

• Secondary filegroups unsupported –piecemeal restore not possible

• Pre-allocate space (and avoid disk and page fragmentation)• SQL can perform more efficient data-file read-aheads• Pre allocating log will reduce VLFs• Avoid autogrowths

• Group (or separate) Site collections for performance and recovery considerations. • FULL recovery for point in time. SIMPLE otherwise• Place active contentdbs on high performance storage

• Use Site Collection Quotas to cap space usage

Page 29: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

In Summary…

• It is important for SharePoint Pros to understand a little of SQL and for SQL Pros to understand a little of SharePoint – try and talk to each other regularly

• There are lots of nuances to using SQL Server for SharePoint databases -make sure both you AND your DBA understand them

• Avoid configuring SQL for SQL Server “Best Practices” and instead configure for SharePoint “Best Practices” in the 1st instance

Page 30: SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint Administrators)

Copyright © 2015, SQLCloud Limited. Please do not redistribute, republish in whole or in part without prior permission of content owner. www.sqlcloud.co.uk

Thank you for listening!

Email: [email protected]

Twitter: retracement

Blog: http://tenbulls.co.uk


Recommended