Restore content database in sharepoint server 2007

database-restoresharepoint

I have a site collection set up at web app running at port 80. I have made the backup of the site collection content db using stsadm.exe tool. Now, I want to restore that backup as a new content db of a different site collection – the one set up at web app running at port 500. I have done the following:

  1. Created a backup
  2. Created new web app at port 500 (I did not create a site collection for this web app)
  3. I have removed the content db of that new web app using Central Administration
  4. I have run the stsadm.exe -o addcontentdb -url webapp-at-port-500 -databasename <name>
  5. Command is successfully completed, however when I check the Content Database page for that web app, it says that the Number of Sites is 0! Also, when I try to open http://webapp-at-port-500, I get the error saying that the webpage cannot be found.

Best Answer

There is an annoying limitation of WSS3/2007 that prevents you from attaching the same content database more than once on an entire installation - the ID for the Site Collection is unique, and these are used as primary key in a table in the Config DB (shared for all web apps). You can get round this by either a) attaching the Content DB somewhere else (inconvenient), or hacking the offending table in the Config DB (potentially dangerous, although I've done this a couple of times with no ill effects); see SharePoint Things for details.