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.
In this case, the site collection that the client actually wanted to use was http://sharepointsite/sites/site1 and the site collection at http://sharepointsite didn’t have any useful data. So the client wanted to move the site collection from http://sharepointsite/sites/site1 to http://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 http://sharepointsite/sites/site1 -Path c:\SharePointBackups\backupfilename.bak
- Delete the http://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 http://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 http://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 http://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 http://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.