sql saturday 411 - migrating sharepoint databases and farm configuration using powershell

23
Migrating Databases and Farm Configuration using PowerShell Anthony Obi SQLSaturday #411 / SPSaturday Cambridge 12 th September 2015

Upload: obilogic

Post on 22-Jan-2018

226 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Migrating Databases and Farm Configuration using

PowerShell

Anthony Obi

SQLSaturday #411 / SPSaturday Cambridge

12th September 2015

Page 2: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Common Scenarios

Common Approaches

Power Shell Demos: Backup / Restore SQL Databases Export / Import Configuration

Considerations / Gotcha’s

Agenda

Page 3: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Demo Environment

• SharePoint Server 2013 SP1 (+May 2015 CU)• Single Web Application (+MySites Web App)• Single Site Collection (+MySites) • Managed Metadata Service Application• User Profile Service Application

• SQL Server 2014 + SP1 • x2 SQL Instances

x2 SharePoint Servers

SQL2014

SP2013Srv1 SP2013Srv2

Page 4: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Common Requirements: Backup -> Restore Data

Export -> Import Configuration

Synchronise Content and Configuration Between Dev / Staging / Production SharePoint Farms

SharePoint Farm Rebuilds:

Domain Moves/Migrations

SQL Infrastructure Moves/Upgrades

Disaster Recovery (…possible option)

Common Scenarios

Page 5: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

SQL

SQL Management Studio, SQL Agent Jobs

PowerShell

SQL Cmdlets, SharePoint Cmdlets (covered in demos)

SharePoint

Central Administration

3rd Party - Various available…

Common Approaches

Page 6: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Demo 01

Content Database ‘SQL Backup and Restore’

PowerShell Example

Page 7: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Demo 02

Content Database SharePoint Aware ‘SQL Restore’

PowerShell Example

Page 8: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

1. Run PowerShell from SQL Server:

Requires ‘Remote PowerShell’ calls to SharePoint Server

‘Remote PowerShell Access & Permissions’ must be Pre-Configuredhttp://blogs.technet.com/b/anneste/archive/2014/09/17/how-to-enable-remote-powershell-for-sharepoint-2013-for-non-administrators.aspx

2. Run PowerShell from SharePoint Server:

Requires ‘SQL Server Management Objects (SMO)’ installed on SharePoint Serverhttps://msdn.microsoft.com/en-us/library/hh248032%28v=sql.120%29.aspx

Any ‘FilePath Parameters’ are local to SQL Server (NOT SharePoint Server)

Approach Options

Page 9: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Post Restore Tasks

Security: Move-SPUser Cmdlet Changed Domain Names

Changed Account Names (User accounts, NOT Service Accounts)

http://technet.microsoft.com/en-us/library/ff607729%28v=office.15%29.aspx

3rd Party Solutions

Ensure Custom Solutions / Features Deployed (.wsp/ .app)

SharePoint Infrastructure Managed Metadata – Site Navigation, Available Term Sets etc

User Profile Service – Recreate Service Application(s), Connections etc.

Search – Update Topology, Content Sources, Crawls etc

Page 10: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Managed Metadata Service Database

https://technet.microsoft.com/en-us/library/Cc263199.aspx#databases

Page 11: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Demo 03

SharePoint Service Application Configuration Export / Import

PowerShell Example

Page 12: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Import Gotcha’s(Issue 1)

If the commands fails with the following error message

“You do not have permission to use the bulk load statement”

The Service Application Service Accountrequires the ‘BULK ADMIN’ SQL Role

Page 13: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Import Gotcha’s(Issue 2)

If the commands fails with the following error message

“Cannot bulk load because the file "<FilePath>\<GUID>\ECMGroup.dat” could not be opened”

Store the Exported ‘.cab’ file on a Network Share.

When SQL and SharePoint are on different servers, the ‘Import-SPMetadataWebServicePartitionData’ PowerShell command needs to perform tasks on both the SP server *and* the SQL server, so both servers need access to the Export file.

Page 14: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

User Profile Service Application Databases

1. Profile Database:Used to store user profile information.

2. Synchronization Database:Used to store configuration and staging information for synchronizing profile data from external sources such as the Active Directory Domain Services (AD DS).

3. Social Database:Used to store social tags and notes created by users. Each social tag and note is associated with a profile ID.

https://technet.microsoft.com/en-us/library/Ee662538.aspx

Page 15: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

User Profile Service Application Databases

https://technet.microsoft.com/en-us/library/Cc263199.aspx#databases

Page 16: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Demo 04

Complex Service Application Configuration Export / Import

PowerShell Example

Page 17: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Security / Service Accounts Matching Domains Matching Accounts (SIDs not Username\Password)

SharePoint Infrastructure Matching SharePoint Versions - Service Pack/Patch Levels Matching Service Applications Matching Web Applications / IIS Configurations

Farm Infrastructure Compatible SQL Versions - Service Pack/Patch Levels Matching Server Names, Roles etc.

(use ‘SQL Aliases’ to perform SQL Server moves/upgrades)

3rd Party Solutions

SQL Restore Considerations / Gotcha’s(Part 1)

Page 18: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

SQL Restore Considerations / Gotcha’s(Part 2)

SP ConfigurationDatabase

Service Application Databases

(Various limitations: Search, UPS, State, Word Automation, Usage)

Service Application Databases

(Various limitations: Search, UPS, State, Word Automation, Usage)

SP Content Databases SP Content Databases SP Content Databases

100% Infrastructure Match(virtualised, scripted install)

Security MatchSP Infrastructure Match

Matching SharePoint Versions - Service Pack/Patch Levels

Page 19: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

About Me Independent SharePoint Consultant

Obilogic Ltd

Working with SharePoint since Portal Server 2001 (10 years+)

MCITP / MCTS SharePoint 2010

Blog: http://community.obilogic.co.uk

Twitter: @obilogic

Email: [email protected]

Page 20: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell
Page 21: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Stick around for SWAG! (Prize drawing at 5.00 p.m)

All our volunteers and organisers do not get paid for running SPS SQLSaturday Cambridge and do it because they believe in the power of community (or are just plain nuts). Please show your gratitude for making this possible by:

Giving them a hug

Shaking their hand

Saying thank you

Coming back next year

Consider getting your company to pay for a precon next year

Spreading the word

Getting involved yourself

But most of all, by enjoying the day!

Don’t forget to thank the sponsors for their support

Thank the speakers for donating their time, energy and expenses

Page 22: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Stick around for SWAG! (Prize drawing at 5.00 p.m)

SQLCloud — XBox One!!! (make sure you know how to play the Jet Set Willy vendor competition!)

SQLCloud—Dark Side Of The Moon, The Wall and Wish You Were Here

Microsoft — MCP Voucher

Data Idols — Supercar Driving Experience

Profisee — Signed MDS Book and £50 Amazon Voucher

SQLSentry — Plan Explorer PRO License

Pyramid Analytics—Coffee Machine

Effektor — Lego Big Ben

Rencore — SPCAF Professional License (valued at $2099!)

Axioworks — Amazon Fire TV and £75 Amazon Voucher

DELL — Beats by Dr Dre Headphones

Redgate — DLM Workshop

Pluralsight — Annual Plus subscriptions

All Your Base Conference — 3 x Conference Tickets

VisualSP—Annual training subscription

Loads of books and much much more!!!

Page 23: SQL Saturday 411 - Migrating SharePoint Databases and Farm Configuration Using PowerShell

Thanks For Listening…