In the world of technology, we often need to migrate the user data from one place to another place in order to keep the application up-to-date. For the same reason, in SharePoint, we often migrate our content database from one farm to another farm or one version to another version.
So here, I will explain the easy method to move your content database from one environment to another environment. I will move the content database called “EDEMO” from http://dev.sharepoint.com environment to http://prod.sharepoint.com.
Note
Before proceeding, make sure that you have taken the SQL backup and stored it in a different location and made sure that both SharePoint Farms are using the same database version.
In my case, I have taken the SQL backup and stored it in a different drive and as my first step, I made that database status offline by clicking Application Management -> Manage Content Database -> click that database and change the status to offline.


On the next pop-up, tick "Drop Connections" and "Update Statistics" options to detach the database smoothly.

Or, you can run the below-mentioned PowerShell script to detach the content database.
- Dismount-SPContentDatabase –WebApplication http://sharepoint.com –Name “DatabseName”
Note
Don’t execute Remove-SPContentDatabase cmdlets, it will remove the content database permanently.
Step 3

Step 4



Step 7



- Mount-SPContentDatabse –WebApplication http://sharepoint.com –Name “DatabaseName”
Step 11

Another method to verify if the content database is successfully attached to the respective web application is by navigating Central Administration -> Application Management -> View all Site Collections.

Here, you can see all the site collection information which was available in the content database.

Join the conversation! Your thoughts help the community grow.