Tuesday, June 26, 2012

Attaching and Detaching a Sharepoint Content Database to a Webapplication

                A common scenario where we might have to attach and detach a database is when the webapplication is down due to some reason.And because of this you are not able to access any of the site collections in this particular web application.

Usually this happens when a lot of team members login to the development server with the service account(which is not recommended) and carry out different activities and somehow the webpplications gets corrupted and wont be accessible though it shows up in the Central Administration console.
In case you have already spent more than an hour to bring your webpplication up and still there are no results you can follow the below steps,

1) Delete the existing web application
2)Create a new web application at the same port
3)Add your old content database to the same webapplication

Detailed steps



1) Delete the existing web application

i) Browse to Central Administration -> Application Management -> Manage Content Databases.

ii) Select the webpplication you are planning to delete.Make a note of the associated database and copy it to a notepad.

iii) Browse to Central Administration -> Application Management -> Manage web Applications.

iv) Select the web application which is having the issue -> Delete.

v) A prompt box pops up.Make the selection as shown below.


vi) Now your webapplication and the associated IIS website is also deleted.But your contnet database is still intact in the SQL database.

2)Create a new web application at the same port

i) Browse to Central Administration -> Application Management ->New

ii) Create a new Web Application at the same port where you deleted your old web application.

3)Add your old content database to the same webapplication

i) Browse to Central Administration -> Application Management -> Manage Content Databases.

ii) Select the webpplication you just created -> Add a content database.



iii) The Add Content database page shows up.



iv) Copy and paste the database name which you had copied in step 1. Click OK.

v) Now you would see two content databases for your webapplication.Your old content database is now connected to new web application you created in step 2.




You should be able to access your old site collections now with the same URL.

1 comment:

  1. What a great blog !!!! Sir u r genius ..........................articulately and easily explained articles.
    Best for novice and experienced !!!

    ReplyDelete