Уреди

Делите путем


Move-SPSite

Moves site collections from one content database to another.

Syntax

Move-SPSite
    [-Identity] <SPSitePipeBind>
    -DestinationDatabase <SPContentDatabasePipeBind>
    [-AssignmentCollection <SPAssignmentCollection>]
    [-Confirm]
    [-RbsProviderMapping <Hashtable>]
    [-WhatIf]
    [-CopyEvents <Boolean>]
    [<CommonParameters>]

Description

The Move-SPSite cmdlet moves the data in the specified site collection from its current content database to the content database specified by the DestinationDatabase parameter.

A no-access lock is applied to the site collection to prevent users from altering data within the site collection while the move is taking place.

Once the move is complete, the site collection is returned to its original lock state.

An IIS reset is required on any server running the Microsoft SharePoint Foundation Web Application service for the site move to take effect. This is not required for SharePoint Server 2019.

The destination content database specified must already exist, must be attached to the same SQL Server as the site collection's current content database, and must be attached to the site collection's current Web application.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.

Examples

---------------------EXAMPLE 1-----------------------

Move-SPSite https://servername/sites/sitename -DestinationDatabase ContentDb2

This example moves the site collection https://servername/sites/sitename to the content database ContentDb2.

---------------------EXAMPLE 2-----------------------

Get-SPSite -ContentDatabase ContentDb1 | Move-SPSite -DestinationDatabase ContentDb2

This example moves all site collections in ContentDb1 to ContentDb2.

---------------------EXAMPLE 3-----------------------

Get-SPSiteAdministration | where { $_.OwnerLoginName -eq "DOMAIN\username" } | Move-SPSite -DestinationDatabase ContentDb2

This example moves all site collections where DOMAIN\username is the site collection owner to ContentDb2. The Get-SPSiteAdministration cmdlet is used instead of the Get-SPSite cmdlet because you must have permission within the site collection to access the properties of the SPSite object. You can access the properties of the SPSiteAdministration object as a SharePoint farm administrator.

---------------------EXAMPLE 4-----------------------

Move-SPSite -Identity siteUrl -DestinationDatabase databaseName -RbsProviderMapping
       @{"sourceProvider1"="targetProvider1", "sourceProvider2"="targetProvider2"}

This example moves an RBS-enabled site collection from one RBS-enabled content database to another RBS-enabled content database, sourceProvider1 is the source RBS provider and targetProvider1 is the target RBS provider.

Parameters

-AssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Type:SPAssignmentCollection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Confirm

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-CopyEvents

Specifies if events of the EventCache table need to be copied to the destination Content Database.

The valid values are True or False.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DestinationDatabase

Specifies the content database that the site collection should be moved to. For example, ContentDB2.

Type:SPContentDatabasePipeBind
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Identity

Specifies the identity of the site collection to be moved. For example, https://servername/sites/sitename.

Type:SPSitePipeBind
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-RbsProviderMapping

This parameter was added in SharePoint Server with Service Pack 1 (SP1) and SharePoint Foundation with Service Pack 1 (SP1).

Used to move an RBS-enabled site collection from one RBS-enabled content database to another RBS-enabled content database without moving the underlying BLOB content. If the content database has more than one RBS provider associated with it, you must specify all providers. The same providers must be enabled on the target content database and the source content database.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-WhatIf

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition