共用方式為


Copy-SPSite

複製網站集合。

語法

Default (預設值)

Copy-SPSite
    [-Identity] <SPSitePipeBind>
    [-TargetUrl] <String>
    [-AssignmentCollection <SPAssignmentCollection>]
    [-DestinationDatabase <SPContentDatabasePipeBind>]
    [-HostHeaderWebApplication <String>]
    [-PreserveSiteId]
    [<CommonParameters>]

Description

使用 Copy-SPSite Cmdlet 將網站集合從隱含的來源內容資料庫複製到指定的目的地內容資料庫。

網站集合的復本具有新的 URL 和新的 SiteID。 當您在執行SQL Server 的計算機上具有資料庫快照集功能時,會在複製期間建立源資料庫的暫存快照集,以防止在複製程式期間發生任何數據變更。 如果您在執行 SQL Server 的伺服器上沒有資料庫快照集功能,您可以備份來源,並將其還原至目的地以取得相同的結果。

如需適用於 SharePoint 產品的 Windows PowerShell 權限及最新資訊,請參閱線上文件 SharePoint Server Cmdlet

範例

Copy-SPSite https://contoso/sites/OldTeam -DestinationDatabase WSS_Content -TargetUrl https://contoso/sites/NewTeam

此範例會將 https://contoso/sites/OldTeam 網站集合從其資料庫複製到 WSS 內容資料庫,並使用新的 URL (https://contoso/sites/NewTeam 及新的網站識別碼。

參數

-AssignmentCollection

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

管理物件以適當處置它們。 使用 SPWeb 或 SPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。 您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。 使用 SPWeb、SPSite 或 SPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。

使用 Global 參數時,所有物件會包含在全域儲存區內。 若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。

參數屬性

類型:SPAssignmentCollection
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DestinationDatabase

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定傳送複本之目的地位置。

參數屬性

類型:SPContentDatabasePipeBind
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-HostHeaderWebApplication

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

當網站集合是主機名網站集合,可讓網站登陸正確的 Web 應用程式時,請使用 。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Identity

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

指定要複製的網站集合。 可以是有效的 URL 或 GUID。

參數屬性

類型:SPSitePipeBind
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:1
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-PreserveSiteId

適用:SharePoint Server 2016,SharePoint Server 2019

指定是否要儲存 SiteID。

有效值為 True 及 False。 預設值為 False。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-TargetUrl

適用:SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

用於網站集合之目的地複本的 URL。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:2
必要:True
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters