SharePoint On premise Restoring Content Databases between Farms
In SharePoint On premise like 2013, 2016, 2019 you may face situations where you will need to restore content database between production/test/dev.
Here you are the steps:
1- Take SQL backup.
2- Copy backup to the other farm.
3- Attach to the SQL server.
4- from Central admin in the farm you would like to restore to go to application management then content database and select the correct web application.
5- detach the old Database and attach the copied one.
Is it ready?
Not yet as when you do that the sites will come with the path that was created in the previous farm i.e. contoso.com but in this farm you want it to be contoso-tst.com
so how you fix it?
do iisreset and restart timer service
run the following commands for each site to modify URL
$site = Get-SPSite -Identity http://consoto.com$site.Rename(“https://consoto-tst.com”)
after that u will see the new site reflected but it may need that you detach the database from SharePoint and give it few minutes then attach it again.