Wednesday, February 19, 2020

Site Collection Backup and Restore process using SharePoint 2010 Management Shell


Click Start
Go to All Programs
Go to Microsoft SharePoint 2010 Products
Open SharePoint 2010 Management Shell
A PowerShell command prompt will appear and you need to format the following to fit the backup for your site.
Backup-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
I recommend creating a folder where you can place these backups before starting the backup process so they aren’t just chill in on the C: drive of your SharePoint server; just a thought.  Here is a little explanation of those additional parameters that are inside the braces [ ]
Force – Include this if you want to override a backup with the same name
NoSiteLock – Will prevent the site from going to Read only mode while the backup is being taken.  A small warning, if someone changes content on the site while the backup is being created and according to Microsoft “might lead to possible data corruption”
UseSQLSnapshot – A database snapshot will be taken before the backup begins and the backup will be done off the snapshot. The advantage is that changes can be made to the site while the backup process is running without fear of corruption.  The snapshot will be deleted automatically when the backup is completed.  You don’t need to specify the -NoSiteLock parameter when using this method
Here is a simple example of what the script may look like if you want to just do a backup:

Backup-SPSite -Identity https://contoso/  -Path D:SharePointBackupsBISite20-2-2020.bak
To do site restores the syntax is almost just as easy.  You will need to use the same SharePoint 2010 Management Shell as doing the backup.
Restore-SPSite -Identity NewSiteCollectionURLHere -Path BackupFilePathHere [-DatabaseServer DatabaseServerNameHere] [-DatabaseName ContentDatabaseNameHere] [-HostHeader HostHeaderHere] [-Force] [-Verbose]
DatabaseServer – Specify the server for the content database
DatabaseName – Specify the name of the content database
HostHeader – URL of the Web application that will hold the host-named site collection
Force – Overwrite the site collection if it exists
GradualDelete – Recommended for site collections over 1 Gig in size, existing data is marked as deleted and gradually removed over time by a job rather than all at once to reduce the performance hit of deleting large amounts of data


No comments:

Post a Comment