Wednesday, May 22, 2013

Attaching a Content DB to a Web Application in SharePoint 2007




For each Web Application you create in SharePoint, by default, there is a single Content DB that is assigned to it. Typically, the steps for creating a web application are as follows:
  1. Launch your Central Administration web site.
  2. On the Quick Launch bar to the left of the page, click on Application Management.
  3. Under the SharePoint Web Application Management heading, click on Create or extend Web application.
  4. Click on Create a new Web Application.
  5. The Create New Web Application page requires some information before creating your new web application. I won’t go through all of this in detail, but let’s pay particular attention to the Database Name and Authentication section. I have attempted in the past to alter the database name to match the already existing content db i would like this web application to use. This is not recommended nor does it work consistently. What you’ll want to do is accept all defaults for the database name and proceed with creating your web application. In the next steps we’ll outline how you swap this content db out for the one your already existing content db.
Now once your content db has been created, you’ll need to go back to the Application Management screen. From there, try the following:
  1. Click on Content databases.
  2. On the right of the toolbar, look for the Web Application drop down. Make sure you change this to match the web app you’re trying to replace the content db for. I find that sometimes this is defaulted to the Central Admin web application which is not what we want.
  3. Click on the database name link, this should bring up the Manage Content Database Settings page. Change your Database status to Offline and check Remove content database. Click OK. This content db shouldn’t contain anything since we just created this web application.
  4. We should now be redirected back to the Manage Content Databases page. Click on Add a content database.
  5. The only thing you need to change on this page is the Database Name field. Set this to the name of the content db you want to add. Set the search server and click OK.
Now typically this is a smooth operation, however, if you encounter the error below:
" Attaching this database requires an upgrade, which could time out the browser session. You must use the STSADM command ‘addcontentdb’ to attach this database."
Open up a command prompt window, and type the following stsadm command in:

stsadm -o addcontentdb -url http://server01/ -databasename WSS_Content
There are other arguments you can use for this command, to see a list of those, type:

stsadm -o addcontentdb
Once the command has completed successfully, try loading your site. If you have any issues at all with this, drop me a line.

Reference
http://blog.qumsieh.ca/2009/02/13/attatching-a-content-db-to-a-web-application/

No comments:

Post a Comment