Tuesday, November 10, 2009

Moving Site Collections between Content Databases

I recently had to move a lot of site collections between content databases. The reason is that we don't want content databases to exceed 100GB. We have quota system in place where each site collection has a quota specified.

I did some planning to ensure that the total size of a content database do not exceed 100GB by summing all the quotas of the site collections. i.e. More content databases were created.

There are a lot of blogs out there to move site collections and I am not going to duplicate that. Just a little something I learned along the way.

Make sure there is enough disk space for the move. In other words ensure the drive the log file for the originating content database and the target content database has enough space. If the site collection is 20GB make sure you have 25GB disk space each for the LOG's and another 25GB for the target content database.

If you don't have enough disk space the process will fail. This is what happened to me. But, I then made sure there is adequate disk space for the move. And then the process failed because the Site collection already exists in the target content database. I never cleaned up the previous attempt's writing to the content database.

I then made matters worse by using stsadm -o deletesite -siteid -databasename . I wanted to delete the orphan site in the target content database. Not knowing that the command will remove the site collection out of the configuration.

So now the original content database had the orphan site collection. Luckily this can be fixed easily enough.

stsadm -o deletecontentdb -databasename -url
stsadm -o addcontentdb -databasename

The addcontentdb command forces SharePoint to remap all the site collections in the content database. So the data was never deleted, it was just "lost", or an orphan.

No comments:

Post a Comment