Moving SharePoint Site Collections
Recently, a client had created a web application with a number of site collections. Most of the site collections were just used for testing purposes.
SharePoint can only create one site collection at the root (i.e. https://sharepointsite). All the other site collections are created using relative URLS like this https://sharepointsite/sites/sitename.
In this case, the site collection that the client actually wanted to use was https://sharepointsite/sites/site1 and the site collection at https://sharepointsite didn’t have any useful data. So the client wanted to move the site collection from https://sharepointsite/sites/site1 to https://sharepointsite.
There is a PowerShell command Move-SPSite but this command only moves the site collection to a different content database.
How to move a SharePoint Site Collection:
- Run the following PowerShell command to back up the site collection. This command can also be performed in Central Admin.
- Backup-SPSite –Identity https://sharepointsite/sites/site1 -Path c:\SharePointBackups\backupfilename.bak
- Delete the https://sharepointsite/sites/site1 site collection. SharePoint doesn’t allow you to create a copy of an existing site collection within the same web application and content database. You can run the Remove-SPSite –Identity https://sharepointsite/sites/site1 or use Central Admin.
Partly to reduce the load on the server, SharePoint will not actually delete the site collection right away. You will not be able to restore the site collection to the same content database until the site collection has been completely removed.
Note: The Restore-SPSite PowerShell command will require a Force switch if there is already a root site collection.
- You can restore the site collection to a different content database i.e. Restore-SPSite https://sharepointsite –Path c:\SharePointBackups\backupfilename.bak –Force –DatabaseServer SQLServerName –DatabaseName ContentDatabaseName OR Run the following Get-SPDeletedSite PowerShell command to see the all the deleted site collections.
- Run Remove-SPDeletedSite –Identity SiteGUID or Remove-SPDeletedSite –Identity /sites/site1
- Run the Gradual Delete job from the Monitoring area in Central Administration (see below for details).
- Run the restore command below to restore the backed up site collection to the root site.
- Restore-SPSite https://sharepointsite –Path c:\SharePointBackups\backupfilename.bak –Force
Run the Gradual delete job
Open Central Admin and select Monitoring.
Select Review job definitions.
Find the Gradual Site Delete job for the web application.
Click on the Gradual Site Delete job to view the details and click the Run Now button.
Backup a site in Central Admin
Open Central Admin and select Backup and Restore.
Select Perform a site collection backup under Granular Backup.
Select the site collection, enter the name of the File location of the backup file and click the Start Backup button.
Delete the https://sharepointsite/sites/site1 site collection
Open Central Admin and select Application Management.
Select the Delete a site collection link under Site Collections.
Select the site collection and click the Delete button.
This SharePoint Tip was written by:
Elizabeth Brown is a Consultant/Programmer whose expertise in implementing and customizing SharePoint and CRM is a great addition to the Corporate Renaissance Group team. Elizabeth has over 6 years of experience working in IT, focusing on system analysis and application development and support. In these roles, she worked directly with end users to develop and customize applications to meet long term needs. In addition to SharePoint and CRM, she has extensive experience with web based technologies and SQL databases.
- Accounting / Finance (33)
- Atlassian (2)
- Budgeting & Costing (21)
- Business Applications (19)
- Business Intelligence (25)
- Cloud (8)
- Collaboration & Sharing (13)
- Company News (22)
- Corporate Performance Management (22)
- Dynamics 365 Business Central (19)
- Dynamics CRM (13)
- Dynamics GP (42)
- Enterprise Resource Planning (10)
- Events (8)
- GP Add-Ons (1)
- Leadership/Business Management (8)
- SharePoint (18)
- Talent Management (9)