Export the Subweb using STSADM

The first step is to export the subweb using the STSADM command line utility. First, connect to the SharePoint server. Open a command prompt and navigate to the folder containing the STSADM executable. Next, execute the following command:

 stsadm.exe -o export -url http://myserver/mysubweb -filename c:\mysubweb.bak -includeusersecurity -versions 4
This will export all content of the subweb to a file called mysubweb.bak located on the c:\ drive. 
By the way, you can choose any location you want to export the file - 
it doesn't have to be on the c:\ drive. If you see “There is not enough space on the disk” error,
the solution is to change the TEMP and TMP environment variable to point to a temport folder. You will 
need to log out and log in for the variables to take the effect.

Create a New Site Collection

Next, create a new site collection in SharePoint central administration. If possible, use the same site template when creating the new site collection as the template that was used to create the subweb you exported. Also, make sure that your account (or the account you are logged into the SharePoint server as) is set up as a site collection administrator. This is required for the content import (next step) only.

Once the new site collection has been created, double check that all needed features are activated. If you chose the same site template as the exported subweb then you probably will have everything you need. But just to be sure, check the Site and Site Collection features on the new Site Collection with those activated on the original site.

If you want to create a Site Collection in a specific Content Database.

Add a new Content Database using Central Administration > Application Management > Content Databases > Add Content Database:

NOTE! Make sure ”Maximum numbers of sites that can be created in this database” minus ”Current number of Sites” equals the largest number in which you want to add the new Site Collection:

Go ahead and create a new Site Collection:

Go back to the Content Database overview to see that the new Site Collection has been created in the new Content Database:

Adjust “Number of sites before a warning event is generated” and “Maximum number of sites that can be created in this database” to make sure new Site Collections are added to the correct content database:

After making this adjustment, new Site Collections are added to the WSS_SharePoint_Content database.

If you already have a Site Collection and you want to move it to its own Content Database you can use the following stsadm commands:

stsadm -o backup -url http://server/sites/sitename -filename c:\sitename.bak

stsadm -o deletesite -url http://server/sites/sitename

stsadm -o restore -url http://server/sitename -filename c:\sitename.bak

Make sure the sum between “Current Number of Sites” and “Maximum Number of Sites” is the largest in the content database you want to use before you run the stsadm –o restore command.


Import Content to the New Site Collection

The last step is to import all of the exported content. On the SharePoint server, open a command prompt and navigate to the folder containing STSADM. Next, execute the following command.

 stsadm.exe -o import -url http://myserver/sites/mynewsitecollection -filename c:\mysubweb.bak -includeusersecurity


Once complete, all content should now be moved into the new site collection.