Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am currently running a SharePoint 2007 Farm.

I have a subsite (http://server/sites/hr/finance) that I wish to move to its own site collection (http://server/sites/finance).

I exported the subsite using stsadm -o export. Then I created the new site collection (http://server/sites/finance). Then I attempted to import the site using stsadm -o import.

However, I'm getting the following error: "The file cannot be imported because its parent web does not exist"

I am running as the Site Collection administrator.

share|improve this question
    
It would definitely make more sense to your question (and its title) if you stated directly that you are talking about sharepoint. –  Weboide Jul 25 '10 at 22:10
    
We have a Sharepoint install where every team site is in its own site collection. It's been like that for years. It prevents all kinds of functionality, particularly using lists between sites, and is a PITA to undo. My advice - don't do it :-) –  dunxd Feb 10 '12 at 14:18

3 Answers 3

Have a look at Gary Lapointe's custom STSADM command gl-convertsubsitetositecollection - this automates the process of exporting, creating a managed path, importing etc.

share|improve this answer
    
I will test this out asap, but it sounds exactly like what I was looking for. I will update this once I get it tested. –  user7862 Jul 30 '10 at 2:21

NOTE: When I post links, I don't have reputation, so I replaced "http" with "hxxp"...just change the xx's to tt's :p

This works for me every day: A little bit about my setup: When I'm migrating sites, it's usually going between servers.

If it's all going to be on the same server, even easier.

If you ARE going between servers, you just have to do the export on the source server, and then create the new content database/managed path/blank site collection, and run the import on the destination server.

At any rate, run this, substituting your URL and file path to where you want to back up at:

stsadm -o export -url hxxp://server/sites/site -filename Z:\SPBackups\sites\site\sites_to_backup.cmp -includeusersecurity -nofilecompression -versions 4

Now, go to Central Administration > Application Management.

If this site will be in a new content database, create that.

Now go back to Application Management, create a new managed path if you need to.

Then, "Create Site collection".

Choose the "Blank Site Template" (or whatever the exact wording is, i forget). Click create, and wait for it to finish creating a blank site collection for you.

After it has been created, DO NOT browse to the site. After it has been created, DO NOT browse to the site. After it has been created, DO NOT browse to the site. After it has been created, DO NOT browse to the site.

Run this in command prompt:

stsadm -o import -url hxxp://server2/newsite -filename C:\SPBackups\sites\site\sites_to_backup.cmp -includeusersecurity -nofilecompression

It should import everything as-is, using the same template that was used on the source server.

Now, browse to your new site collection. Everything should come up fine, with the exception of some broken links.

To fix this, go to http://stsadm.blogspot.com. Install his custom STSADM extensions. The one you want is located here: hxxp://stsadm.blogspot.com/2009/01/replacing-navigation-urls-using-stsadm.html.

You'll run this command: stsadm -o gl-replacenavigationurls –url "hxxp://server/newsitecollection" –searchstring "hxxp://server/oldsitecollection/oldsubsite" –replacestring "hxxp://server/newsitecollection" –scope Site

That command will go to the new site collection (hxxp://server/newsitecollection) and search within the entire site for the string "hxxp://server/oldsitecollection/oldsubsite", and replace that with "hxxp://server/newsitecollection". So any links that were pointing to the old site (document libraries, lists, etc) will be modified to go to the new site collection's URL.

Hope this helps!

PS - You can also use the extension that Gary has for gl-convertsubsitetositecollection...works wonders. But this is generally what I use, since it is not too complicated.

share|improve this answer

There is no good way to move the whole sub-site to a top site. Pretty much, if ever a sub-site, forever a sub-site.

This kinda works... You could save the sub-site as a Site Template, use stsadm to add the template as a global template, and create the new topsite collection from this Site Template. WARNING: There are many problems with doing this, many galleries may be missing (the Web Part gallery will not be correctly populated for instance).

But, it's best to do it all over... If you MUST have this site as a top site - rebuild it, bit by bit. Luckily you have some tools available to ease the pain: Export / Import web parts, Save Lists as Templates w/ contents - add them to the new site, etc...

share|improve this answer
    
The problem is I have about a dozen of these to do. Not simple at all. –  user7862 Jul 28 '10 at 4:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.