2

I have two web applications, webapp1 and webapp2 in SharePoint 2016. Each one contains a root site collection. I need to copy the site collection from webapp1 to webapp2 as a site collection.

I tried different methods like: Backup and restore, but that gave me some errors. Moving content database from one webapp to another, but then I mounted the database, it was showing 0 sites collections.

Anyone has got some good scripts which can do exactly what I am asking?

I followed the steps in this Technet page: https://technet.microsoft.com/en-us/library/cc262792.aspx

Mount-SpContentDatabase

Dismount-SPContentDatabase WSS_Content_DB1

Mount-SPContentDatabase WSS_Content_DB1 -DatabaseServer spsql01 -WebApplication http://webapptest.aston.local

Using Copy-SPSite

Copy-SPSite http://spapp01:4696 -DestinationDatabase WSS_Content_DB1 -TargetUrl http://webapptest.aston.local
3
  • how did you try to backup? what version of sharepoint are you using?
    – Danilo
    Dec 19, 2016 at 14:01
  • Could you please share the errors and steps you followed
    – Waqas Sarwar MVP
    Dec 19, 2016 at 14:38
  • It is sharepoint 2016 Dec 19, 2016 at 15:37

1 Answer 1

3

Use Backup-SPSite/Restore-SPSite. This method will generate a new Site ID for the restored site so you can use it within the same farm (sites within farms must have unique IDs).

4
  • Is it possible to user Restore-SPSite to restore the content dabase for a site collection which is not the root site collection? This content database has to be used by a site collection which is secondary. Dec 19, 2016 at 18:28
  • That question doesn't make sense. You can take a backup of a site collection and restore it to any location/content database associated with the web application you want.
    – Trevor Seward
    Dec 19, 2016 at 18:29
  • suppose I do a backup the content database directly from SQL Server and I restore the db in another farm. How can I attach this content database to this site collection, for example: dev2/sites/secondsite ? Dec 20, 2016 at 14:10
  • You don't. You attach a Content Database to a Web Application. Those Site Collections will then be associated with that Web Application.
    – Trevor Seward
    Dec 20, 2016 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.