在 SharePoint Server 中還原伺服器陣列Restore farms in SharePoint Server

摘要:了解如何還原 SharePoint Server 2016 和 SharePoint 2013 伺服器陣列。Summary: Learn how to restore a SharePoint Server 2016 and SharePoint 2013 farm.

您可以使用SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來還原 SharePoint Server 伺服器陣列。所使用的備份工具取決於已部署的環境類型、備份排程以及您組織的服務等級協定而定。You can restore a SharePoint Server farm by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. The backup tool that you use depends on the kind of environment that you have deployed, the backup schedule, and service level agreements that you have made with your organization.

開始之前Before you begin

通常只有在牽涉整個伺服器陣列的失敗或無法局部復原伺服器陣列的一部分之後,才會執行伺服器陣列等級復原。如果您只需要還原伺服器陣列的一部分、特定資料庫、服務應用程式、清單或文件庫或特定文件,請使用其他復原方法。如需替代形式之復原的詳細資訊,請參閱<相關內容>。Farm-level recovery is usually performed only after a failure that involves the complete farm, or where partial recovery of part of the farm is not possible. If you only have to restore part of the farm, a specific database, a service application, a list, or document library, or a specific document, use another recovery method. For more information about alternate forms of recovery, see Related content.

伺服器陣列復原通常是因下列任何原因而執行:Farm recovery is usually performed for any of the following reasons:

  • 在火災、嚴重損壞、設備失敗或其他資料遺失事件之後還原伺服器陣列。Restoring a farm after a fire, disaster, equipment failure, or other data-loss event.

  • 將伺服器陣列組態設定和資料還原為特定先前時間和日期。Restoring farm configuration settings and data to a specific previous time and date.

  • 將 SharePoint Server 部署從某個伺服器陣列移至其他伺服器陣列。Moving a SharePoint Server deployment from one farm to another farm.

開始這項作業之前,請先檢閱下列如何還原 SharePoint 伺服器陣列的相關資訊:Before you begin this operation, review the following information about how to recover a farm in SharePoint:

  • 您無法從一個版本的 SharePoint Server 2016 進行備份,並還原至另一個版本的 SharePoint Server 2016 ,或從一個版本的 SharePoint Server 2013 進行備份,並還原至另一個版本的 SharePoint Server 2013。You cannot back up from one version of SharePoint Server 2016 and restore to another version of SharePoint Server 2016 or from one version of SharePoint Server 2013 and restore to another version of SharePoint Server 2013.

  • 備份伺服器陣列會備份設定和管理中心內容資料庫,但是無法使用 SharePoint Server 工具還原這些項目。如需如何備份和還原所有伺服器陣列資料庫的詳細資訊,請參閱<移動 SharePoint Server 中的所有資料庫>。Backing up the farm will back up the configuration and Central Administration content databases, but these cannot be restored using SharePoint Server tools. For more information about how to back up and restore all of the farm databases, see Move all databases in SharePoint Server.

  • 當您使用 SharePoint Server 還原伺服器陣列時,還原程序不會自動啟動所有服務應用程式。您必須使用管理中心或 Microsoft PowerShell 手動啟動它們。請不要使用 SharePoint 產品設定精靈啟動服務,因為這樣做也會重新佈建服務和服務 Proxy。如需詳細資訊,請參閱<在 SharePoint Server 中啟動或停止服務>。When you restore the farm by using SharePoint Server, the restore process will not automatically start all of the service applications. You must manually start them by using Central Administration or Microsoft PowerShell. Do not use SharePoint Products Configuration Wizard to start the services because doing this will also re-provision the services and service proxies. For more information, see Start or stop a service in SharePoint Server.

  • 當您使用內建工具還原或重新附加資料庫時,會保留每個內容資料庫的識別碼 (ID)。使用內建工具時的預設變更記錄保留行為如下:The identifier (ID) of each content database is retained when you restore or reattach a database by using built-in tools. Default change log retention behavior when using built-in tools is as follows:

    • 當您還原伺服器陣列時,會保留所有資料庫的變更記錄。The change logs for all databases are retained when you restore a farm.

    • 當您重新附加或還原資料庫時,會保留內容資料庫的變更記錄。The change log for content databases is retained when you reattach or restore a database.

      如果保留資料庫識別碼和變更記錄,則搜尋系統會根據編目規則所定義的定期排程繼續進行編目。When a database ID and change log are retained, the search system continues crawling based on the regular schedule that is defined by crawl rules.

      如果您還原現有資料庫,而且未使用覆寫選項,則會將新識別碼指派給還原的資料庫,而且不會保留資料庫變更記錄。下一次編目資料庫會將內容資料庫中的資料新增至索引。When you restore an existing database and do not use the overwrite option, a new ID is assigned to the restored database, and the database change log is not preserved. The next crawl of the database will add data from the content database to the index.

      如果執行還原,而且備份套件中的識別碼已用於伺服器陣列,則會將新識別碼指派給還原的資料庫,並在還原記錄中新增一則警告。執行累加編目而非完整編目的功能,是取決於與之前相同的內容資料庫識別碼,而且搜尋系統所使用的變更記錄 Token 適用於內容資料庫中的目前變更記錄。如果未保留變更記錄,則 Token 無效,而且搜尋系統必須執行完整編目。If a restore is performed and the ID in the backup package is already being used in the farm, a new ID is assigned to the restored database and a warning is added to the restore log. The ability to perform an incremental crawl instead of a full crawl depends on the content database ID being the same as before and the change log token that is used by the search system being valid for the current change log in the content database. If the change log is not preserved, the token is not valid and the search system has to perform a full crawl.

  • SharePoint Server 備份會備份 Business Data Connectivity Service 外部內容類型定義,但不會備份資料來源本身。若要保護資料,則應該在備份 Business Data Connectivity Service 或伺服器陣列時備份資料來源。SharePoint Server backup backs up the Business Data Connectivity service external content type definitions but does not back up the data source itself. To protect the data, you should back up the data source when you back up the Business Data Connectivity service or the farm.

    如果您還原 Business Data Connectivity Service 或伺服器陣列,然後將資料來源還原至不同位置,則必須在外部內容類型定義中變更位置資訊。否則,Business Data Connectivity Service 可能會找不到資料來源。If you restore the Business Data Connectivity service or the farm and then restore the data source to a different location, you must change the location information in the external content type definition. If you do not, the Business Data Connectivity service might be unable to locate the data source.

  • 只有在您使用 FILESTREAM 遠端 BLOB 存放區提供者將資料放於遠端 BLOB 存放區時,SharePoint Server 才會還原遠端二進位大型物件 (BLOB) 存放區。SharePoint Server restores remote Binary Large Objects (BLOB) stores only if you are using the FILESTREAM remote BLOB store provider to put data in remote BLOB stores.

    如果您使用其他提供者,則必須手動還原遠端 BLOB 存放區。If you are using another provider, you must manually restore the remote BLOB stores.

  • 如果跨伺服器陣列共用服務應用程式,請注意伺服器陣列備份中不會包含已交換的信任憑證。您必須分開備份憑證存放區,或將憑證保留在不同的位置。當您還原共用服務應用程式的伺服器陣列時,您必須匯入並重新部署憑證,然後重新建立伺服器陣列之間的任何信任。If you are sharing service applications across farms, be aware that trust certificates that were exchanged are not included in farm backups. You must back up your certificate store separately or keep the certificates in a separate location. When you restore a farm that shares a service application, you must import and redeploy the certificates, and then re-establish any inter-farm trusts.

    如需詳細資訊,請參閱<在 SharePoint Server 中交換伺服器陣列之間的信任憑證>。For more information, see Exchange trust certificates between farms in SharePoint Server.

  • 還原設定成使用宣告式驗證的 Web 應用程式之後,通常會看到重複或其他宣告提供者。如果出現重複的提供者,則必須手動儲存每個 Web 應用程式區域,以移除這些提供者。如需詳細資訊,請參閱<在 SharePoint Server 中還原 Web 應用程式>。After a Web application that is configured to use claims-based authentication is restored, duplicate or additional claims providers are often visible. If duplicates appear, then you must manually save each Web application zone to remove them. For more information, see Restore web applications in SharePoint Server.

  • 如果您還原的伺服器陣列包含設定為使用表單型驗證的 Web 應用程式,則必須進行其他步驟。如需詳細資訊,請參閱在 SharePoint Server 中還原 Web 應用程式Additional steps are required when you restore a farm that contains a Web application that is configured to use forms-based authentication. For more information, see Restore web applications in SharePoint Server.

使用 PowerShell 還原 SharePoint 中的伺服器陣列Using PowerShell to restore a farm in SharePoint

您可以使用 Microsoft PowerShell 還原伺服器陣列。You can use Microsoft PowerShell to restore a farm.

使用 PowerShell 還原伺服器陣列To restore a farm 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 管理命令介面。Open the SharePoint Management Shell.

  3. 在 PowerShell 命令提示字元處,輸入下列命令:At the PowerShell command prompt, type the following command:

    Restore-SPFarm -Directory <BackupFolder> -RestoreMethod Overwrite [-BackupId <GUID>]<Type the appropriate cmdlet, including parameters and values, and enclose the values for the parameters in "placeholder" tags >
    

    其中:Where:

    • <BackupFolder> 是您用於儲存備份檔案的資料夾路徑。<BackupFolder> is the path of the folder you use for storing backup files.

    • <GUID> 是從中還原備份的識別碼。<GUID> is the identifier of the backup to restore from.

      注意

      [!附註] 如果您未以伺服器陣列帳戶登入,則系統會提示您輸入伺服器陣列帳戶的認證。If you are not logged on as the Farm account, you are prompted for the Farm account's credentials.

      若不指定 BackupId,則會使用最近的備份。若要檢視伺服器陣列的備份,請在 Microsoft PowerShell 命令提示字元處輸入下列命令:If you do not specify the BackupId, the most recent backup will be used. To view the backups for the farm, at the Microsoft PowerShell command prompt, type the following command:

    Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是您用於儲存備份檔案的資料夾路徑。<BackupFolder> is the path of the folder you use for storing backup files.

      您無法使用僅設定備份來還原內容資料庫與設定。You cannot use a configuration-only backup to restore content databases together with the configuration.

  4. 若要重新啟動服務應用程式,請在 PowerShell 命令提示字元處輸入下列命令:To restart a service application, at the PowerShell command prompt, type the following command:

    Start-SPServiceInstance -Identity <ServiceApplicationID>
    

    其中:Where:

    • <ServiceApplicationID> 是服務應用程式的 GUID。<ServiceApplicationID> is the GUID of the service application.

      如需如何使用 PowerShell 重新啟動服務應用程式的詳細資訊,請參閱<Start-SPServiceInstance>。For more information about how to restart service applications by using PowerShell, see Start-SPServiceInstance.

如需如何使用 PowerShell_2nd_NoVer 還原伺服器陣列的詳細資訊,請參閱<Restore-SPFarm.PShell_stsadm_deprecated>。For more information about how to restore the farm by using PowerShell_2nd_NoVer, see Restore-SPFarm.PShell_stsadm_deprecated

使用管理中心還原伺服器陣列Using Central Administration to restore a farm

您可以使用管理中心網站還原伺服器陣列。You can use the Central Administration Web site to restore a farm.

使用 管理中心 還原伺服器陣列To restore a farm by using Central Administration

  1. 確認執行此程序的使用者帳戶為 SharePoint 伺服器陣列管理員群組的成員。Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.

  2. 在 管理中心首頁的 [備份與還原] 區段中,按一下 [從備份還原]。In Central Administration, on the home page, in the Backup and Restore section, click Restore from a backup.

  3. 在從備份還原-步驟 3 之 1: 選取備份還原] 頁面上,從清單中的備份,選取包含伺服器陣列備份的備份工作,然後按 [下一步。您可以依序按一下 [(+) 備份旁的檢視有關每個備份的詳細資訊。On the Restore from Backup — Step 1 of 3: Select Backup to Restore page, from the list of backups, select the backup job that contains the farm backup, and then click Next. You can view more details about each backup by clicking the (+) next to the backup.

    注意

    如果未顯示正確的備份工作,在 [備份目錄位置] 文字方塊中輸入正確的備份資料夾的通用命名慣例 (UNC) 路徑] 和 [重新整理。您無法使用僅限設定備份中還原伺服器陣列。If the correct backup job does not appear, in the Backup Directory Location text box, type the Universal Naming Convention (UNC) path of the correct backup folder, and then click Refresh. You cannot use a configuration-only backup to restore the farm.

  4. 在 [從備份還原 - 步驟 3 之 2: 選取要還原的元件] 頁面上,選取伺服器陣列旁的核取方塊,然後按 [下一步]。On the Restore from Backup — Step 2 of 3: Select Component to Restore page, select the check box that is next to the farm, and then click Next.

  5. 在從備份還原-步驟 3 之 3: 選取還原選項] 頁面的 [還原元件] 區段中,確定伺服器陣列] 出現在 [還原下列元件] 清單中。On the Restore from Backup — Step 3 of 3: Select Restore Options page, in the Restore Component section, make sure that Farm appears in the Restore the following component list.

    在 [僅還原組態設定] 區段中,確定已選取 [還原內容與組態設定] 選項。In the Restore Only Configuration Settings section, make sure that the Restore content and configuration settings option is selected.

    在 [還原選項] 區段的 [還原類型,請選取 [相同的設定選項。會顯示對話方塊要求您確認作業。按一下 [確定]In the Restore Options section, under Type of Restore, select the Same configuration option. A dialog box will appear that asks you to confirm the operation. Click OK.

    注意

    若未顯示 [僅還原組態設定] 區段,則您選取的備份會是僅限設定的備份。您必須選取其他備份。If the Restore Only Configuration Settings section does not appear, the backup that you selected is a configuration-only backup. You must select another backup.

    按一下 [開始還原]。Click Start Restore.

  6. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備] 區段中,檢視所有復原工作的一般狀態。在同頁面底部的 [還原] 區段中,則可檢視目前復原工作的狀態。狀態頁面每 30 秒會自動更新。只要按一下 [重新整理],即可手動更新狀態詳細資料。備份與復原都是計時器服務工作。因此,數秒之後才會開始復原。You can view the general status of all recovery jobs at the top of the Backup and Restore Job Status page in the Readiness section. You can view the status for the current recovery job in the lower part of the page in the Restore section. The status page updates every 30 seconds automatically. You can manually update the status details by clicking Refresh. Backup and recovery are Timer service jobs. Therefore, it may take several seconds for the recovery to start.

    如有收到錯誤,可以檢閱 [備份與還原工作狀態] 頁面的 [失敗訊息] 欄。您也可以在步驟 3 中所指定之 UNC 路徑下的 Sprestore.log 檔案中查看詳細資訊。If you receive any errors, you can review them in the Failure Message column of the Backup and Restore Job Status page. You can also find more details in the Sprestore.log file at the UNC path that you specified in step 3.

  7. 完成的還原程序之後,您可能需要重新啟動一或多個服務應用程式。在管理中心內,在 [首頁] 頁面上的 [系統設定] 區段中按一下 [管理伺服器上的服務。在 [伺服器] 頁面上的服務、 啟動任何您想要執行服務應用程式旁的 [動作] 欄中按一下 [重新啟動下列服務應用程式與相關的服務。When the restore process has completed, you may need to restart one or more service applications. In Central Administration, on the home page, in the Systems Settings section, click Manage services on server. On the Services on Server page, start any services related to service applications that you want to run by clicking Restart in the Action column next to the service application.

  8. 重新建立任何信任關係。如需詳細資訊,請參閱<在 SharePoint Server 中交換伺服器陣列之間的信任憑證>。Re-establish any trust relationships. For more information, see Exchange trust certificates between farms in SharePoint Server.

使用 SQL Server 工具還原伺服器陣列Using SQL Server tools to restore a farm

雖然您無法使用 SQL Server 工具還原整個伺服器陣列,但是可以還原大部分的伺服器陣列資料庫。如果您使用 SQL Server 工具還原資料庫,則必須使用管理中心或 PowerShell 還原伺服器陣列設定。如需如何還原伺服器陣列之組態設定的詳細資訊,請參閱在 SharePoint Server 中還原伺服器陣列設定Although you cannot restore the complete farm by using SQL Server tools, you can restore most of the farm databases. If you restore the databases by using SQL Server tools, you must restore the farm configuration by using Central Administration or PowerShell. For more information about how to restore the farm's configuration settings, see Restore farm configurations in SharePoint Server.

注意

[!附註] 搜尋索引未儲存至 SQL Server。如果您使用 SQL Server 工具備份和還原搜尋,則必須在還原內容資料庫之後執行完整編目。The search index is not stored in SQL Server. If you use SQL Server tools to back up and restore search, you must perform a full crawl after you restore the content database.

還原 SharePoint Server 之前,建議您設定復原伺服器陣列進行網站和項目復原。Before you restore SharePoint Server, we recommend that you configure a recovery farm for site and item recovery.

請遵循下列步驟,還原資料庫:Restore the databases by following these steps:

  1. 請儘可能備份目前資料庫的即時交易記錄檔,以保護自從上次完整備份後所進行的任何變更。If possible, back up the live transaction log of the current database to protect any changes that were made after the last full backup.

  2. 還原上次的完整資料庫備份。Restore the last full database backup.

  3. 還原在最近的完整資料庫備份之後,所進行的最近之差異資料庫備份。Restore the most recent differential database backup that occurred after the most recent full database backup.

  4. 還原在最近的完整或差異資料庫備份之後,所進行的所有交易記錄檔備份。Restore all transaction log backups that occurred after the most recent full or differential database backup.

使用下列程序來還原伺服器陣列資料庫。Use the following procedure to restore your farm databases.

使用 SQL Server 工具還原伺服器陣列To restore a farm by using SQL Server tools

  1. 確認執行此程序的使用者帳戶為 sysadmin 固定伺服器角色的成員。Verify that the user account that is performing this procedure is a member of the sysadmin fixed server role.

  2. 如果 SharePoint 計時器服務正在執行,請停止該服務並稍候幾分鐘,直到所有目前執行中的預存程序完成為止。在還原所有需要還原的資料庫之前,請勿重新啟動此服務。If the SharePoint Timer service is running, stop the service and wait for several minutes for any currently running stored procedures to finish. Do not restart the service until after you restore all the databases that you have to restore.

  3. 啟動 SQL Server Management Studio,並連線至資料庫伺服器。Start SQL Server Management Studio and connect to the database server.

  4. 在 [物件總管] 中,展開 [資料庫]。In Object Explorer, expand Databases.

  5. 以滑鼠右鍵按一下要還原的資料庫,並依序指向 [工作] 及 [還原],然後按一下 [資料庫]。Right-click the database that you want to restore, point to Tasks, point to Restore, and then click Database.

    資料庫在復原作業期間會自動離線,且無法供其他程序存取。The database is automatically taken offline during the recovery operation and cannot be accessed by other processes.

  6. 在 [還原資料庫] 對話方塊中指定目的地與來源,然後選取要還原的一或多個備份組。In the Restore Database dialog box, specify the destination and the source, and then select the backup set or sets that you want to restore.

    目的地與來源的預設值適合大部分的復原案例。The default values for destination and source are appropriate for most recovery scenarios.

  7. 在 [選取頁面] 窗格中,按一下 [選項]。In the Select a page pane, click Options.

  8. 在 [還原選項] 區段中選取 [覆寫現有的資料庫。除非您的環境或原則需要否則請勿在本節中選取其他選項。In the Restore options section, select only Overwrite the existing database. Unless your environment or policies require otherwise, do not select the other options in this section.

  9. 在 [復原狀態] 區段中:In the Recovery state section:

    • 如果您已包含所有必須還原的交易記錄檔,請選取 [RECOVER WITH RECOVERY]。If you have included all the transaction logs that you must restore, select RECOVER WITH RECOVERY.

    • 如果您必須還原其他交易記錄檔,請選取 [RECOVER WITH NORECOVERY]。If you must restore additional transaction logs, select RECOVER WITH NORECOVERY.

    • 此案例不會使用第三個選項 [RECOVER WITH STANDBY]。The third option, RECOVER WITH STANDBY is not used in this scenario.

      注意

      [!附註] 如需復原選項的詳細資訊,請參閱<還原資料庫 (選項頁面)>。For more information about these recovery options, see Restore Database (Options Page).

  10. 按一下 [確定] 完成復原作業。Click OK to complete the recovery operation.

  11. 除了設定資料庫之外,也請針對還原的每個資料庫重複步驟 4 到 9。Except for the configuration database, repeat steps 4 through 9 for each database that you are restoring.

    重要

    [!重要事項] 如果您還原 User Profile 資料庫 (預設名稱為 "User Profile Service_ProfileDB_<GUID>"),則也會還原社交資料庫 (預設名稱為 "User Profile Service_SocialDB_<GUID>")。沒這麼做可能會導致 User Profile 資料不正確,因而很難偵測和修正。If you are restoring the User Profile database (by default named "User Profile Service_ProfileDB_<GUID>"), then also restore the Social database (by default named "User Profile Service_SocialDB_<GUID>"). Failing to do this can cause inaccuracies in the User Profile data that might be difficult to detect and fix.

  12. 若要還原組態設定,您必須使用現有設定資料庫,或手動建立新資料庫並將設定還原至該資料庫。如需還原伺服器陣列設定的詳細資訊,請參閱在 SharePoint Server 中還原伺服器陣列設定To restore the configuration settings, you must use the existing configuration database or manually create a new database and restore the configuration to that database. For more information about how to restore the farm configuration, see Restore farm configurations in SharePoint Server.

  13. 啟動 SharePoint Timer Service。Start the SharePoint Timer service.

  14. 啟動任何必須重新啟動的服務應用程式。在管理中心內,在 [首頁] 頁面上的 [系統設定] 區段中按一下 [管理伺服器上的服務。在 [伺服器] 頁面上的服務、 啟動任何您想要執行服務應用程式旁的 [動作] 欄中按一下 [重新啟動下列服務應用程式與相關的服務。Start any service applications that have to be restarted. In Central Administration, on the home page, in the Systems Settings section, click Manage services on server. On the Services on Server page, start any services related to service applications that you want to run by clicking Restart in the Action column next to the service application.

下列清單顯示當您僅需要還原部分伺服器陣列時,可以使用的其他還原方法:The following list shows other recovery methods that you can use when you only need to restore part of your farm: