Partager via


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 https://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 how you’ll achieve that -

- Login with SharePoint Service Account (Farm Account)
- We have a subsite at https://ServerName/global/it/testsite
- STSADM -o export -url https://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 https://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 https://ServerName/global/it/testsite -filename C:testsite.cmp -includeusersecurity
Browse to https://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 https://technet.microsoft.com/en-us/library/cc262407.aspx ]

stsadm -o createsiteinnewdb -url <URL name> -owneremail someone@example.com

[-ownerlogin] <domainname> [-ownername] <display name> [-secondaryemail] <someone@example.com> [-secondarylogin] <domainname> [-secondaryname] <display name> [-lcid] <language> [-sitetemplate] <site template> [-title] <site title> [-description] <site description> [-hostheaderwebapplicationurl] <Web application URL> [-quota] <quota template> [-databaseuser] <database user name> [-databasepassword] <database password> [-databaseserver] <database server name> [-databasename] <database name>

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: https://blogs.technet.com/stefan_gossner/archive/2009/05/27/limitations-of-stsadm-o-export-import-related-to-publishing-sites.aspx