Wednesday, November 4, 2009

SubSite to Site Collection

Lets consider a scenario where a subsite (web) becomes substantially larger and you wish you could have a separate content database and hence decide to have a site collection (top-level site) instead of a subsite and you also want your users to continue browsing the same way they were doing earlier.

e.g. You have a subsite called TestSite http://ServerName/global/it/testsite. Now you want TestSite to become a Site Collection as you want to host it in a separate content database.

Here is the steps to confgure -

- Login with SharePoint Service Account (Farm Account)
- We have a subsite at http://ServerName/global/it/testsite
- STSADM -o export -url http://ServerName/global/it/testsite -filename C:\testsite.cmp -includeusersecurity -versions 4 (Make sure C:\ has got sufficient space to hold export for the TestSite)
- Delete the subsite http://ServerName/global/it/testsite
- Created an 'Explicit inclusion' at /ServerName/it/testsite from Central Administration > Application Management > Define Managed Paths
- Create a new site collection using stsadm –o createsiteinnewdb command > Choose /ServerName/it/testsite and create a site collection with a blank template
- STSADM -o import -url http://ServerName/global/it/testsite -filename C:\testsite.cmp -includeusersecurity
Browse to http://ServerName/global/it/testsite > Path looks exactly like previous subsite and the site is successfully imported and now testsite is a site collection.

Syntax for stsadm –o createsiteinnewdb
[More Info at http://technet.microsoft.com/en-us/library/cc262407.aspx]

stsadm -o createsiteinnewdb -url -owneremail someone@example.com

[-ownerlogin] [-ownername] [-secondaryemail] [-secondarylogin] [-secondaryname] [-lcid] [-sitetemplate] [-title] [-description] [-hostheaderwebapplicationurl] [-quota] [-databaseuser] [-databasepassword] [-databaseserver] [-databasename]

Note: The above method is recommended only for team sites. For sites with Publishing Feature activated there are some limitations with STSADM export / import and hence above operation may fail with an error message like “Data at the root level is invalid”. Read more here: http://blogs.technet.com/stefan_gossner/archive/2009/05/27/limitations-of-stsadm-o-export-import-related-to-publishing-sites.aspx