Backup and Restore Site Collection SharePoint 2016

Move Site Collection to another Web Application in SharePoint

In this post, we’ll learn How to Backup and Restore Site Collection SharePoint 2016 as well as we will show how to Move Site Collection to SubSite in another Web Application.

Applies To

  • SharePoint 2019.
  • SharePoint 2016.
  • SharePoint 2013.
  • SharePoint 2010.

Backup and Restore Site Collection SharePoint 2016

Backup and Restore Site Collection SharePoint 2016

I have two SharePoint web applications on the same farm and I want to move the root site collection from a web application to another web application on the same SharePoint farm or a different farm using PowerShell.

  • Source SharePoint Web Application
    • The main SharePoint web application, Ex: “http://mainwebapplication”
  • Destination SharePoint Web Application
    • The root site collection in another web application on the same SharePoint farm, Ex: “http://mainwebapplication:7000”.

If you are planning to move a site collection to another farm, you should make sure that the current build number of the target farm is the same or higher than the current SharePoint farm build number to avoid this error Your backup is from a different version of SharePoint Foundation and cannot be restored. Also, you can use the database attach upgrade method to move a site collection to another farm as mentioned at Backup and Restore SharePoint Web Application to another Farm.


Backup and Restore Site Collection to another Web Application

To move site collection to another web application in SharePoint 2016, you should do the following:

Steps

  1. Take a backup for the source SharePoint site collection.
  2. Restore the taken back up to the destination web application.
  3. Remove the site collection from the old web application.
  4. Delete the backup file.

Backup Site Collection using PowerShell in SharePoint

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below “Backup-SPSite” cmdlet to take a backup from the specified Site Collection.
Backup-SPSite -Identity http://SiteCollectionPath -Path "C:\\MoveSiteCollection.bak"

This cmdlet will create “.bak” file in the specified path.

You can also use the “-force” parameter to overwrite the .bak file if it already exists.

Backup-SPSite -Identity http://SiteCollectionPath -Path "C:\\MoveSiteCollection.bak" -force

Restore Site Collection using PowerShell in SharePoint

In the destination web application, run the below “Restore-SPSite” cmdlet.

Restore-SPSite -Identity http://SiteCollectionPath:port -Path "C:\\MoveSiteCollection.bak"

you use also use “-Confirm:$false” parameter to avoid asking for a confirmation

Restore-SPSite -Identity http://SiteCollectionPath:port -Path "C:\\MoveSiteCollection.bak"  -Confirm:$false

Remove Site Collection using PowerShell in SharePoint

This step is not mandatory but if you would like to remove the SharePoint site collection from the old web application, you can run the below “Remove-SPSite” cmdlet.

Remove-SPSite -Identity http://SiteCollectionPath -Confirm:$false

Remove SharePoint backup file using PowerShell

After performing the restore, and made sure that everything is working as expected and there is no need for the backup file, so you can remove it using PowerShell as shown below:

  • Open Windows PowerShell as Administrator
  • Run the “Remove-Item” cmdlet to remove the backup file.
Remove-Item "C:\\MoveSiteCollection.bak"

The process to move site collection to another web application on the same SharePoint farm is done. In the next section, we’re gonna explain how to Move Site Collection to SubSite in another Web Application.


Move Site Collection to SubSite in another Web Application

Consider you have a root site collection and you would like to move it to another SharePoint web application as a subsite. In this case, the backup and restore operations don’t work, and you should instead use Export and Import cmdlets.

Export Site Collection using PowerShell in SharePoint

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below “Export-SPWeb” cmdlet with your information.
Export-SPWeb -Identity http://sitecollection -Path c:\\backup\Exportback.cmp -IncludeUserSecurity -IncludeVersions

Don’t forget to add “-IncludeVersions” paramter to incluse the versions.

Import Site Collection to SubSite using PowerShell in SharePoint

In this step, you will use the “Import-SPWeb” cmdlet to import the exported site collection to a subsite in another SharePoint web application.

Import-SPWeb -Identity http://sitecollection/subsite -Path c:\\backup\Exportback.cmp -Force

Note: Unfortunately, the Import and Export cmdlets don’t move the existing workflow, and in this case, you will need to move theses workflows manually or use other third-party tools.


Change SharePoint Web Application Port

To Change a SharePoint Web Application port number, you will need to extend your web application to be able to set the desired SharePoint Web Application port as you prefer.

Steps

  • Open Central Administration > Application Management > Manage web applications.
Manage web application in SharePoint
  • Select the source web application and from the ribbon click on Extend.
extend SharePoint web application
  • The following dialog should be shown to type the new port for the new web application.
Change SharePoint Web Application Port

You might also like to read when you need to Extend SharePoint 2016 Web Application


Conclusion

In conclusion, we have explained how to perform Backup and Restore Site Collection SharePoint 2016, also, we have learned

  • How to Move site collection to another web application in SharePoint.
  • How to Move Site Collection to SubSite in another SharePoint Web Application.
  • How to Change Web Application Port Number In SharePoint.
You might also like to read
Have a Question?

If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.

5 thoughts on “Backup and Restore Site Collection SharePoint 2016”

  1. mohammed butter field

    Hi! I could have sworn I’ve been to this website before but
    after looking at many of the posts I realized it’s new to me.
    Anyways, I’m certainly happy I found it and I’ll be bookmarking it and checking back often!

  2. I really like what you guys are usually up too.
    Such clever work and coverage! Keep up the very good works guys I’ve added you guys to my personal blogroll.

Leave a Reply