Export (0) Print
Expand All

Move site collections between databases (SharePoint Foundation 2010)

SharePoint 2010
 

Applies to: SharePoint Foundation 2010

Topic Last Modified: 2011-03-22

Under some circumstances, you might want to move one or more site collections to a different content database. For example, a site collection can outgrow the content database on which it resides, and you would have to move the site collection to a larger content database. In Windows SharePoint Services 3.0, this process was also known as splitting a content database because of the name of the Stsadm command that was used to perform the procedure. In Microsoft SharePoint Foundation 2010, it is more accurate to view this procedure as moving the site collection to a larger database.

On the other hand, if site collections do not grow to their expected capacity, it might be convenient to combine several site collections onto one content database. In Windows SharePoint Services 3.0, this process was also known as merging content databases. During this process, no content databases are actually merged — the site collections are moved to and consolidated on a new database.

This article describes how to prepare for and move site collections between content databases.

You can move site collections between content databases by using the Stsadm command-line tool or Windows PowerShell 2.0 commands. There is no graphical user interface for this task.

tipTip
You can also move site collections by using Backup and Restore procedures. For information about how to do this, see Back up a site collection (SharePoint Foundation 2010) and Restore a site collection (SharePoint Foundation 2010)

To perform the procedures that are described in this article, verify that the user account has access to one of the servers on which Windows PowerShell 2.0 is running, and that the user account is a member of the following groups:

  • The db_owner fixed database role and the SharePoint_Shell_Access role in the SQL Server source content database, administration content database, destination content database, and configuration database.

  • The WSS_ADMIN_WPG group on the local computer.

For these procedures to work, the following conditions must be true:

  • The destination content database must already exist.

  • The source content database and destination content database must be located on the same instance of SQL Server.

  • The source content database and destination content database must be attached to the same Web application. For more information about how to add a content database to a Web application, see Add a content database (SharePoint Foundation 2010).

importantImportant
If you have applied the October 2010 cumulative update, the default behavior when moving site collections to another content database has changed. After the update is applied, auditing data is moved with the site collection. The auditing data is copied whether you use Central Administration or Windows PowerShell. This size of the auditing data varies depending upon the event collection settings for the site collection.
If the amount of auditing data is large, you can move the data to another database before moving the site collection. To do this, use the To archive and trim audit data by using Windows PowerShell procedure in this article.

In this article:

Regardless of the reason for moving a site collection, you should always begin the task by determining the size of the site collection that is to be moved. You can then be sure that the destination hard disk can sufficiently contain the site collection contents. Verify that the destination hard disk has at least three times the free space that is required for the site collection.

tipTip
You can stay current about the space that site collections are using by creating site quotas and e-mail alerts. For more information about this feature, see Manage site quotas and locks (Windows SharePoint Services).
To determine the size of the site collection
  1. On the Start menu, click All Programs.

  2. Click SharePoint 2010 Products.

  3. Click SharePoint 2010 Management Shell.

  4. At the Windows PowerShell 2.0 command prompt, type the following commands:

    $used = (Get-SPSiteAdministration -Identity <http://ServerName/Sites/SiteName>).DiskUsed
    
    $used
    

    Where:

    • <http://ServerName/Sites/SiteName> is the name of the site collection.

    The amount of disk space that is being used by the specified site collection is stored in the $used variable, and is displayed at the command prompt when the second command is run.

    noteNote
    The amount of disk space that is displayed does not include the disk space used by the auditing data that will be moved with the site collection.

For more information, see Get-SPSiteAdministration.

To archive and trim audit data by using Windows PowerShell
  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. At the Windows PowerShell command prompt, type the following command:

    (Get-SPSite -Identity <http://ServerName/Sites/SiteName>).Audit.TrimAuditLog(deleteEndDate)
    

    Where:

    • <http://ServerName/Sites/SiteName> is the name of the site collection.

    To delete the audit data without archiving it first, type the following command:

    (Get-SPSite -Identity <http://ServerName/Sites/SiteName>).Audit.DeleteEntries(deleteEndDate)
    

For more information, see Get-SPSite.

You can use the Windows PowerShell command Move-SPSite to move site collections between content databases. Two procedures are provided here. The first procedure moves a single site collection to a new content database, and the second procedure moves multiple site collections to a new content database.

To move a single site collection
  • At the Windows PowerShell command prompt, type the following command:

    Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase <DestinationContentDb>
    
    

    Where:

    • <http://ServerName/Sites/SiteName> is the name of the site collection.

    • <DestinationContentDb> is the name of the destination content database.

To move multiple site collections
  • At the Windows PowerShell command prompt, type the following command:

    Get-SPSite -ContentDatabase <SourceContentDb> | Move-SPSite -DestinationDatabase <DestinationContentDb>
    

    Where:

    • <SourceContentDb> is the name of the original content database.

    • <DestinationContentDb> is the name of the destination content database.

    This command moves all site collections from the source content database to the destination content database.

For more information, see Move-SPSite.

noteNote
We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft