– 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.
– 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.
– 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.
-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.
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:
- Create a content database using Sharepoint central administration.
- Create site collection that will use this content db.
- delete this content db.
- 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:
- 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.
- Select content databases, and click to add a new content database, name it WSS_Content_test and click ok.
- 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).
- Go back to the link “content databases” and delete the content database you’ve created “WSS_Content_test”.
- Launch Command prompt (CMD) … Start > Run > cmd and hit enter.
- write the following command line:
Stsadm –o addcontentdb –url http://www.xyz.com/Web1 –databasename WSS_Content_Web1
- press enter to execute the command.
Go and browse to your newly created site collection, and enjoy.
- The STSADM tool is usually located in the following path (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN).
- For details about using the command addcontentdb visit this article in TechNet Addcontentdb: Stsadm operation (Office SharePoint Server).