在 SharePoint Server 的伺服器陣列之間複製組態設定Copy configuration settings between farms in SharePoint Server

摘要: 了解如何在 SharePoint Server 2016 和 SharePoint 2013 伺服器陣列之間複製組態設定。Summary: Learn how to copy configuration settings from one SharePoint Server 2016 or SharePoint 2013 farm to another.

您可以使用 Microsoft PowerShell 在 SharePoint Server 伺服器陣列之間複製組態設定。You can copy configuration settings between SharePoint Server farms by using Microsoft PowerShell.

開始之前Before you begin

可以使用許多方法將設定從一個伺服器陣列複製至另一個伺服器陣列。根據要複製組態設定與複製頻率決定您要使用哪種方法。There are many ways in which you can copy configurations from one farm to another. Determine which method to use based on the configuration settings that you want to copy and how often you have to copy them.

  • 備份及還原未附加內容資料庫的伺服器陣列。除了選取的任何服務設定,此方法還提供您伺服器陣列設定與 Web 應用程式設定。Back up and restore a farm without the content databases attached. This method gives you farm settings and Web application settings, in addition to the settings for any service applications that you select.

  • 僅備份及還原設定。此方法僅為您提供核心 SharePoint Foundation 設定。Back up and restore configurations only. This method provides you with the core SharePoint Foundation settings only.

    注意

    此方法不包括 Web 應用程式或服務應用程式設定。如果還原的伺服器陣列中需要 Web 應用程式設定,請使用其他方法。This method does not include Web application or service application settings. If Web application settings are required in the restored farm, use one of the other methods.

  • 根據記錄的設定建立部署指令碼。此方法一開始可能比較費時,但是可讓您輕鬆地用以維護標準化。Create a deployment script, based on your documented configuration. This method may be more work at first, but is easy to use to maintain standardization.

備份與還原不包含內容資料庫的伺服器陣列以複製 SharePoint Server 組態設定Backup and restore a farm without content databases to copy configuration settings in SharePoint Server

若要使用伺服器陣列備份複製組態設定,建議您先卸離內容資料庫與伺服器陣列。不建議您針對即時實際執行伺服器陣列採取此步驟。To copy configuration settings by using a farm backup, we recommend that you first detach the content databases from the farm. This is not a step that we recommend that you take with a live production farm.

注意

建立不包含內容資料庫的伺服器陣列備份可以備份服務應用程式。Creating a farm backup without content databases does back up the service applications.

若要使用 PowerShell 備份及還原不包含內容資料庫的伺服器陣列To back up and restore a farm without content databases by using PowerShell

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。securityadmin fixed server role on the SQL Server instance.

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。db_owner fixed database role on all databases that are to be updated.

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。Administrators group on the server on which you are running the PowerShell cmdlets.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server cmdlets.

      注意

      如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 啟動 SharePoint 管理命令介面。Start the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元處輸入下列命令,以記錄目前的 Web 應用程式 URL 與內容資料庫對應。At the PowerShell command prompt, type the following command to document the current Web application URLs and content database mappings.

    Get-SPWebApplication | %{$_.Name;$_.Url;%{$_.ContentDatabases|%{$_.Name};Write-Host ""}}
    
  4. 卸載所有內容資料庫,如下列範例所示:Either unmount all content databases, as in the following example:

    Get-SPContentDatabase | Dismount-SPContentDatabase
    

    或卸載特定內容資料庫,如下列範例所示:Or unmount a specific content database, as in the following example:

    Get-SPContentDatabase WSS_Content | Dismount-SPContentDatabase
    
  5. 備份伺服器陣列。Back up the farm.

    Backup-SPFarm -Directory \\servername\share -BackupMethod Full
    

    注意

    您可以查看 \servername\share\spbr#### \spbackup.log 檔案以檢視備份的進度。You can view the progress of the backup by looking at the \servername\share\spbr#### \spbackup.log file.

  6. 備份完成後,重新裝載內容資料庫。After the backup is complete, re-mount the content databases.

    Mount-SPContentDatabase -Name <WSS_Content> -WebApplication <http://servername>
    

    使用步驟 1 中記載的每個對應來取代預留位置。Replace the placeholders with each of the mappings documented in step 1.

    其中:Where:

    • <WSS_Content> 是 <資料庫的名稱及識別碼>。<WSS_Content> is the <name and ID of the database>.

    • <http://servername> 是 <Web 應用程式的 URL>。<http://servername> is <the URL of the Web Application>.

如需詳細資訊,請參閱<Mount-SPContentDatabase>。For more information, see Mount-SPContentDatabase.

注意

建議您在執行命令列管理工作時使用 Windows PowerShell。Stsadm 命令列工具已過時,但為與舊版產品相容,仍會隨附提供。We recommend that you use Microsoft 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.

僅備份及復原組態設定Back up and recover configuration settings only

作為伺服器陣列備份的一部分,您可以選取僅備份組態設定。僅設定備份會解壓縮並備份設定資料庫中的多個 (但非全部) 組態設定。無論設定資料庫目前是否附加至伺服器陣列,皆可以使用內建工具備份任何設定資料庫的設定。如需如何備份設定的詳細資訊,請參閱在 SharePoint Server 中備份伺服器陣列設定。設定備份可以還原至同一伺服器陣列,也可還原到任何其他伺服器陣列。若設定備份內設有存在於伺服器陣列中的任何值,則在還原設定時,將會覆寫這些設定。若伺服器陣列的任何現有設定未包含在設定備份中,則不會覆寫這些設定。如需如何還原伺服器陣列設定的詳細資訊,請參閱在 SharePoint Server 中還原伺服器陣列設定As part of farm backup, you can choose to back up only configuration settings. A configuration-only backup extracts and backs up many, but not all, configuration settings from a configuration database. By using built-in tools, you can back up the configuration of any configuration database, whether it is currently attached to a farm or not. For detailed information about how to back up a configuration, see Back up farm configurations in SharePoint Server.A configuration backup can be restored to the same — or any other — server farm. When a configuration is restored, it will overwrite any settings present in the farm that have values that are set within the configuration backup. If any settings present in the farm are not contained in the configuration backup, they will not be overwritten. For detailed information about how to restore a farm configuration, see Restore farm configurations in SharePoint Server.

請參閱See also

概念Concepts

SharePoint Server 的備份與復原概觀Overview of backup and recovery in SharePoint Server