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
Dismount-SPContentDatabase WSS_Content_DB1 Mount-SPContentDatabase WSS_Content_DB1 -DatabaseServer spsql01 -WebApplication http://webapptest.aston.local
Copy-SPSite http://spapp01:4696 -DestinationDatabase WSS_Content_DB1 -TargetUrl http://webapptest.aston.local