• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1340
  • Last Modified:

How to move a SharePoint Site Collection from an Existing Site Collection Database to a New Content Database

I am trying to move an existing Site Collection from one content database to a new content database in Microsoft Office SharePoint Server 2008 with Windows SharePoint Service 3.0. The site collection move is on the same server, which is where the complication from the instructions I've read so far, which seem to be focussed on moving or duplicating a site collection to a new website application, on a different production or testing server, but not from one site collection to another site collection on the same production server.

Here are links to what I've followed or done so far.

http://emadmagdy.wordpress.com/2009/01/23/a-very-quick-way-to-restore-sharepoint-site-collection-way-quicker-than-stsadm-o-backuprestore/

http://technet.microsoft.com/en-us/library/cc262087.aspx

I've done the following: Using stsadm.exe I've backed up the site collection to a database file. I've then duplicated the Content Database in SQL Management Studio. I've then created the new Website Application and created a blank Site collection to where I want to move the site collection. I've tried "restore" with stsadmin (http://technet.microsoft.com/en-us/library/cc262087.aspx) to this new site collection:but that didn't work. I then tried removing the new Content Database from the new site collection and then added the duplicated content database in SQL to this new site collection using stsadm with -addcontentdb, which completes successfully, but shows "0" for the number of sites in the site collection, when it should appear as 6, when comparing it to the original Site collection and it's content database.

Any instructions on what I need to do to duplicate the site collection to a new website application and content database would be HUGE right now. I've been trying this for 2 days now with no success and I need help.

Thanks.
0
tedjpclark
Asked:
tedjpclark
  • 15
  • 13
4 Solutions
 
FFNetAdminsCommented:
With the right tools this can be painless. Believe it or not, this is actually a pretty common practice. When we initially started using SharePoint, we put all of our Site Collections on one content DB, which quickly grew to an unmanageable size. Our solution was to pull each site collection out and on to its own content DB, which would make backups, restores, and moving much more efficient.

Here's what we did...

-Make a SQL backup of the content database your going to be working with (safety first)
-On your web front end, use: stsadm -o backup -url http://sharepoint/sitecollection -filename d:\DriveWithLotsOfRoom.spb
-In Central Admin, go to your content databases and add a new content database with the name and server you want to use
-Click on all other content databases and change database status to "stopped". This will force your restore to your newly created DB
-Via command line on the web front end, delete the site collection you made the backup of
-In Central Admin, remove the managed path for your site collection once site has been deleted
-Recreate the managed path
-Create a new site collection via stsadm (not Central Admin), but do not go to that site because it will force you to pick a theme on your first visit (bad)
-Now if you open Central Admin and go to content databases, you'll notice that your new site has been created on your new content database
-On your web front end, use stsadm -o restore -url http://sharepoint/sitecollection -filename d:\DriveWithLotsOfRoom.spb -overwrite (notice the -overwrite)
-After successful restore, be sure you change your other content databases back to "Ready" from "Offline" in Central Admin. By the way, "Offline" doesn't mean the DB is not working or serving up web pages, it just means that you can't create any new site collections on that content DB. It's a good way to manage content dbs.

When your done, don't forget that you can shrink the database your site used to be on. This will allow you to recover the space that your site collection used. Does all this make sense?
0
 
MsShadowCommented:
What FFNet says is completely correct, only thing I would like to add to it is that you can also do this with stsadm -o export and stsadm -o import.
0
 
tedjpclarkAuthor Commented:
When I do the restore, I get the following error.
"The site collection could not be restored. If this problem persists, please make sure the content databases are available and have sufficient free space."

When I go into the application log on the SPS server I see the following related error.
A runtime exception was detected. Details follow.
Message: A duplicate site ID 0a42d867-0c7a-4bd3-b4aa-dd80867a463a(http://ie.intranet.nrcc.org) was found. This might be caused by restoring a content database from one server farm into a different server farm without first removing the original database and then running stsadm -o preparetomove. If this is the cause, the stsadm -o preparetomove command can be used with the -OldContentDB command line option to resolve this issue.

What am I doing wrong, or do I need to do?
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
FFNetAdminsCommented:
Did you completely remove the old site and managed path before recreating it on the new content database?
0
 
FFNetAdminsCommented:
Also, is your new content database in a "Ready" state while the others are "Offline"?
0
 
tedjpclarkAuthor Commented:
I should probably clarify I am trying to take an existing site collection, creating a new web application, and trying to restore the original backup to this new site collection/web application. From what I understand I need to have performed the -duplicating an existing site collection, and try to restore trying stsadm –o PrepareToMove before or addcontentdb -assignnewdatabaseid to get this to work. Any help would be great. I'm in over my head at this point and can't figure out how to get the original site collection back.

Oh I should mention that once I restored the site collection to the new web application it worked, but the other site collection disappeared and is unreachable now.
0
 
tedjpclarkAuthor Commented:
FFNetAdmins;
To your above question: 1) Did you completely remove the old site and managed path before recreating it on the new content database?
My Answer; Yes I removed the old site completely, but I didn't remove the managed path. I can try that.
2) Also, is your new content database in a "Ready" state while the others are "Offline"?
My Answer: No I did not try that, but I will.

If i do these two above things will it create a new content database that when I do the restore it won't have the conflicting ID?
0
 
FFNetAdminsCommented:
That's what I'm thinking. Also, in doing so, it will create the site collection on the new content database because it's the only content DB "Ready" for new site collections.
0
 
tedjpclarkAuthor Commented:
Just to be safe, if I take the other Content Databases "offline" people will be able to still browse the sites, they just won't be able to create new site collections? I want to make sure, since for this particular case there isn't any failover system, there's only one production SharePoint Front end server and only one production MS SQL database.(Against what I recommended).

I'm going to try your recommended approach, and if it doesn't work I've seen information that doing an "stsadm -o addcontentdb -assignnewdatabaseid" can be used as a last resort. If you have any other suggestions, please let me know.
0
 
FFNetAdminsCommented:
I definately understand your concerns for your production data. Taking a database "offline" only disables new Site Collections from being created via Central Administration (something you would do, not a standard user). Despite the confusing term Microsoft gave this, it will still allow you to browse sites, create Document Libraries, Documents, additional sites, etc.

In the future, you should look at creating a small development virtual environment to perform upgrades and structure changes on. You can download MS Virtual Server 2005 for free, which will allow you to host a few servers on, something perfect for your 2 servers. Something to think about. Good luck!

0
 
tedjpclarkAuthor Commented:
One other question: what if I don't delete the site collection of what I'm backing up? It's not in the same web application, but I imagine this is the reason I'm getting the ID issue. My goal is to NOT delete the original, simply to duplicate it, but that may be my problem. I'm not sure if MS allows you to duplicate two site collections on the same server.

The goal is to have one system that people use and update, while another group simply is able to view the same data, but I will be adding new custom web parts to the second site to filter and restrict people's access. I know I could be doing that through permissions through the first site, but structurally, it would require different web parts to load depending on the permissions group... which would require rewriting the whole system since for the most part the web parts in the original system are standard Microsoft SP web parts.

Does this make sense?
0
 
FFNetAdminsCommented:
It sounds like you're trying to attach a copy of your original content database to another web application, is that correct? If so, you won't be able to do this- I just tried this and received the same error message you did. They only way you can have a copy of your site on another web application is to create a new Content DB on this new web application and then restore/import it in.
0
 
FFNetAdminsCommented:
Sounds like you need a Virtual Server with a few guest servers to create a new development farm :)
0
 
tedjpclarkAuthor Commented:
OK so, I now know why this isn't working. To get this to restore to the new web application I'll need to "restore/import" it? Do you have any info on what I need to do to accomplish this?

I imagine I'll need to use stsadm -o export and export the original site collection to a file. Then create a new site collection with a new content database, then use stsadm -o import to import the original site collection to the new site?

If you have any details about how I need to perform this, at this point, I could use the help.

Oh and YEAH I have been recommending that we have some sort of development or testing resources, but of course no one listened. Maybe they'll start listening now that I've had to do all of this in production (NOT FUN, VERY SCARY!!!)

Let me know if you have any additional info. Thanks.
0
 
tedjpclarkAuthor Commented:
OK I'm now trying to perform a backup and restore but I keep getting "command line error. Invalid parameter". Here's what I'm typing:

stsadm.exe -o export -url http://ie.intranet.cab.org/districts/ -filename "c:\SharePointBackups\DRS_FullBackup\DRS_Restore\DRS_BackUp1" -includesecurity -versions 4 -nofilecompression -quiet -overwrite

Why does this not work?
0
 
tedjpclarkAuthor Commented:
I'm following the instructions from the following site: http://technet.microsoft.com/en-us/library/cc262759.aspx
0
 
FFNetAdminsCommented:
How big is the site collection?
0
 
FFNetAdminsCommented:
Try this, with or without the quotes, I forget.

stsadm.exe -o export -url http://ie.intranet.cab.org/districts/ -filename "c:\SharePointBackups\DRS_FullBackup\DRS_Restore\DRS_BackUp1"

You'll get the security regardless of the inclusion at the end. You don't need to -overwrite unless the file already exists. Just try the above without any extras.
0
 
tedjpclarkAuthor Commented:
Your Question: How big is the site collection

My answer: around 3 GBs I believe
0
 
tedjpclarkAuthor Commented:
FFNetAdmins Your suggested stsadm export code IS correct! (YOU ARE AWESOME!!)

I'm currently watching it perform the export. One question if there are subsites to this site collection, will it export those as well, or will I need to do this for each subsite?

0
 
FFNetAdminsCommented:
It should be a nice and clean import after exporting. Don't forget to create the new managed path and also create the site collection using stsadm, NOT Central Admin (you do not want to pick a theme, your site you will be importing already has a theme). Then immediately import the site with the -overwrite option. You should be golden after that.

Let me know how it goes and I'll respond back via my mobile a litte later.
0
 
FFNetAdminsCommented:
Your export will grab all sites in your site collection.
0
 
tedjpclarkAuthor Commented:
You are awesome! I'll keep you updated on the progress. Thank you so Much!
0
 
tedjpclarkAuthor Commented:
I've tried to create the new site collection using the following stsadm command, but it keeps trying to create the site in an old Content Database, not the new one I created and added to the Web application? I've taken all the "old" content databases "offline" in SQL Management Studio, except for the new Content Database I'm hoping to create the site collection in. What am I doing wrong?

stsadm.exe -o createsite -url http://2010.intranet.cab.org/districts -owneremail MOSSAdmin@NRCC.org -ownerlogin NRCC\mossadmin -title "District Reporting System" -hostheaderwebapplicationurl http://2010.intranet.cab.org/districts

Should I try to create the site collection via the Central Administration site?
0
 
tedjpclarkAuthor Commented:
When I run the above command I get the following error:

"Cannot open database "2010_Intranet_General" requested by the login. The login failed. Login failed for user 'CAB\mossadmin'"

Just looked at the Content Database 2010_Intranet_General, and it's owner is CAB\sqlagent and for the NEW content database CAB\mossadmin IS the owner.

What am I doing wrong?
0
 
tedjpclarkAuthor Commented:
Forget my last 2 comments, I figured it out. I was looking at the wrong place to take the databases offline. I've corrected my mistate (in Central Administration, NOT SQL Management). I'm onto importing the site.
0
 
FFNetAdminsCommented:
Nice- sounds like you're moving forward now.
0
 
tedjpclarkAuthor Commented:
One last problem. Though I restored everything correctly, none of the web-oparts are showing any information, though they reference everything correctly? Is this common?
0
 
FFNetAdminsCommented:
Since you created a new web application, you might need to pull them in. Try this...

On the top-leve of your site collection, click Site Actions, Site Settings, under 'Galleries' click Web Parts. Since you probably don't see them listed in here, just click 'New' and locate them in that lengthy list of web parts. Select the ones you need and then click 'Populate Gallery'. The webparts should be back on your page.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 15
  • 13
Tackle projects and never again get stuck behind a technical roadblock.
Join Now