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:

  1. Run the following PowerShell command to back up the site collection. This command can also be performed in Central Admin.
  2. Backup-SPSite –Identity https://sharepointsite/sites/site1 -Path c:\SharePointBackups\backupfilename.bak
  3. 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.

  1. 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.
  2. Run Remove-SPDeletedSite –Identity SiteGUID or Remove-SPDeletedSite –Identity /sites/site1
  3. Run the Gradual Delete job from the Monitoring area in Central Administration (see below for details).
  4. Run the restore command below to restore the backed up site collection to the root site.
  5. Restore-SPSite https://sharepointsite –Path c:\SharePointBackups\backupfilename.bak –Force

Central Admin:

Run the Gradual delete job

Open Central Admin and select Monitoring.

1

Select Review job definitions.

2

Find the Gradual Site Delete job for the web application.

3

Click on the Gradual Site Delete job to view the details and click the Run Now button.

4

Backup a site in Central Admin

Open Central Admin and select Backup and Restore.

5

Select Perform a site collection backup under Granular Backup.

7

Select the site collection, enter the name of the File location of the backup file and click the Start Backup button.

8

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.

9

Select the site colle10ction and click the Delete button.

 

 

This SharePoint Tip was written by:

Elizabeth Brown

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.