This article describes how to attach or detach Microsoft SharePoint Server 2010 content databases by using the SharePoint Management Shell.
You might want to attach or detach content databases in the following situations:
- You want to add a new content database for new site collections to keep content databases at a manageable size.
- You have restored a content database from another farm and you want the sites that it contains to be accessible from a Web application.
- You have archived site collections and you no longer need as many content databases. You can move the remaining site collections out of a content database and then detach the content database from the Web application. For more information, see Move site collections between databases (SharePoint Server 2010)
Here is I have done So Far
restore your content database on your SQL Server which you want to attach your web-application
for doing that first find it out current attach database name of your web application. though on
Central Administration > Application Management > Manage Content Database And select your webapplication.
suppose : ⦁ During creation “http://sp2010:9997” web application I have given content database name was “wss_content_LCWP_OldCloud”.
dismount above database using like this:
Open SharePoint Management Shell(as Administrator)
Than attach your new content databases to your web-application
Mount-SPContentDatabase "" -DatabaseServer "" -WebApplication http://SiteName
For Example :
Mount-SPContentDatabase "wss_content_5000" -DatabaseServer "DBSERVERNAME" -WebApplication http://sp2010:9997