How to copy a sitecollection to a new content database

This post shows how to copy a sitecollection within the same farm. Very useful to do some testing where you don’t want to mess up your content.

Lets pretend that you have a sitecollection http://source.test.com that uses the content database WSS_Content_Source. Now we want to copy this sitecollection within the farm and with a new content database.

The operation can be broken down into these steps.

1. Backup a sitecollection
      using stsadm “stsadm -o backup -url http://source.company.com -filename sourcesitecollbackup.bak”

2. Create a new webapplication (using central admin)

      port: 80
      hostheader: dest.company.com (remember to add a hostheader to c:\windows\system32\drivers\etc\hosts – if you aren’t using a DNS server)
      contentdatabase: WSS_Content_Dest

3. Create a sitecollection (using Central admin)

      Same language and template as the source (or perhaps I think you could create a blank one – havent tried)

4. Restore your backup

      using stsadm:” stsadm -o restore -url http://dest.company.com -filename sourcesitecollbackup.bak -overwrite” (remember to overwrite)

5. IISRESET

You should now have a exact copy of your source sitecollection on the http://dest.company.com with its own content database

 

, , ,

  1. Leave a comment

Leave a comment