"backup/restore" actually copy the whole site collection to a file, then re-import it into SharePoint farm. This approach works well. But, instead of external file, we can also use a temporary database to hold the site collection data. Comparing to "backup/restore", it's much faster.
Below is the PowerShell script.
Mount-SPContentDatabase -AssignNewDatabaseId -Name SP_Content_Tmp -DatabaseServer $DatabaseServer -WebApplication $WebAppUrl
Copy-SPSite -Identity $SiteUrlSource -DestinationDatabase SP_Content_Tmp -TargetUrl $SiteUrlDest
Remove-SPSite -Identity $SiteUrlSource -confirm:$false
Get-SPTimerJob -WebApplication $WebAppUrl job-site-deletion | Start-SPTimerJob
Move-SPSite -Identity $SiteUrlDest -DestinationDatabase $ContentDatabase -Confirm:$false
Get-SPTimerJob -WebApplication $WebAppUrl job-site-deletion | Start-SPTimerJob
Dismount-SPContentDatabase -Identity SP_Content_Tmp -Confirm:$false
[update, 2016-10-19]
Windows Form program to generate PowerShell script:
https://github.com/Eric-Fang/SPSiteAdmin2013
https://github.com/Eric-Fang/SPSiteAdmin2016
No comments:
Post a Comment