Move content Databases using PowerShell


To attach or to detach an existing content database use the below power shell command

Mount-SPContentDatabase "<ContentDb>" –DatabaseServer "<DbServer>" –WebApplication http://your WebapplicationName

Where


<ContentDb>: is the content database to be attached.

<DbServer>  : is the name of the database server.

http://your WebapplicationName :is the name of the Web application to which the content database is being attached.

To detach a content database use the below power shell command

Dismount-SPContentDatabase "<ContentdBName>"