sql saturday 411 - migrating sharepoint databases and farm configuration using powershell
TRANSCRIPT
Migrating Databases and Farm Configuration using
PowerShell
Anthony Obi
SQLSaturday #411 / SPSaturday Cambridge
12th September 2015
Common Scenarios
Common Approaches
Power Shell Demos: Backup / Restore SQL Databases Export / Import Configuration
Considerations / Gotcha’s
Agenda
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
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
SQL
SQL Management Studio, SQL Agent Jobs
PowerShell
SQL Cmdlets, SharePoint Cmdlets (covered in demos)
SharePoint
Central Administration
3rd Party - Various available…
Common Approaches
Demo 01
Content Database ‘SQL Backup and Restore’
PowerShell Example
Demo 02
Content Database SharePoint Aware ‘SQL Restore’
PowerShell Example
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
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
Managed Metadata Service Database
https://technet.microsoft.com/en-us/library/Cc263199.aspx#databases
Demo 03
SharePoint Service Application Configuration Export / Import
PowerShell Example
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
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.
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
User Profile Service Application Databases
https://technet.microsoft.com/en-us/library/Cc263199.aspx#databases
Demo 04
Complex Service Application Configuration Export / Import
PowerShell Example
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)
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
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]
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
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!!!
Thanks For Listening…