Friday 30 March 2012

Add existing Content database to a Site collection using STSADM

Stsadm Addcontentdb

 

Scenario
- You have an old content database (mdf/ldf or a backup) that you want to use as a content database for a new site collection.
or
- You want to create a new site collection, and to use an already existing content database (that holds your old data) for this site collection.

Assumption
- At the back-end SQL server you have a content database (in this example i will name it WSS_Content_Web1) attached to the SQL server, that is not linked to any site collection yet.
or
-At the back-end SQL server you’ve created a new database (in this example i will name it WSS_Content_Web1) using SQL management studio and restored a backed-up content database to it, to be used as a content database for you new site collection.

Steps
I will refer to this content database as WSS_Content_Web1, and the site collection as http://www.xyz.com/Web1

 

What we are up to do is:

  1. Create a content database using Sharepoint central administration.

  2. Create site collection that will use this content db.

  3. delete this content db.

  4. use STSADM to link this newly created site collection to the existing content database (in this example i will name it WSS_Content_Web1) in the back-end SQL.


 

So let us start:

  1. Launch “SharePoint 3.0 Centeral Administration”, and under the category “SharePoint Web Application Management” Select “Web application list” then select the web application that will contain the site collection.

  2. Select content databases, and click to add a new content database, name it WSS_Content_test and click ok.

  3. Create a new site collection, name it Web1. (notice that the new site collection will be attached to the newly created content database (WSS_content_test).

  4. Go back to the link “content databases” and delete the content database you’ve created “WSS_Content_test”.

  5. Launch Command prompt (CMD) … Start > Run > cmd and hit enter.

  6. write the following command line:
    Stsadm –o addcontentdb –url http://www.xyz.com/Web1 –databasename WSS_Content_Web1

  7. press enter to execute the command.


Go and browse to your newly created site collection, and enjoy.

 

notes:

  1. The STSADM tool is usually located in the following path (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN).

  2. For details about using the command addcontentdb visit this article in TechNet Addcontentdb: Stsadm operation (Office SharePoint Server).

No comments:

Post a Comment