Thursday, December 20, 2012

How to attach repaired SharePoint Content Database to SharePoint Server

If you have restored or recovered your corrupt content database from another farm and wanted to access the sites from a Web application that farm contains then in this case, you have to first attach your content database to the farm. You can do it by using Windows PowerShell, SharePoint Central Administration. If you are performing command-line administrative tasks then I will recommend you to use Windows PowerShell because sometimes Stsadm command-line tool raise error message during this process. Here are all steps: 

1. Windows PowerShell:  Before using this step, first you should check that user account should be the SQL Serverdbcreator member. After that use following steps:

Start menu>>All Programs>>Microsoft SharePoint 2010 Products>>Click SharePoint 2010 Management Shell.

At the Windows PowerShell command prompt, type following command to attach repaired content database:

Mount-SPContentDatabase "" -DatabaseServer "" -WebApplication http://SiteName

2. SharePoint Central Administration:  Before using this step, first you should check that user account should be the farm Administrators SharePoint group member. After that use following steps:

  • SharePoint Central Administration Web site>>Application Management.
  • Application Management page>>Databases section>>Manage content databases.
  • Manage Content Databases page>>Add a content database.
  • Add Content Database page> select the Web application from Web Application drop-down menu to which you want to attach a content database.
  • Specify the database server, database name & authentication method for the database.

       Note: if you are using SQL authentication then also supply an account name and password.

  • Click Ok

Final Words:  You can also de-attach your content database by using Windows PowerShell and SharePoint Central Administration. 

No comments:

Post a Comment