在 SharePoint Server 中還原服務應用程式Restore service applications in SharePoint Server

摘要: 了解如何在 SharePoint Server 2016 和 SharePoint 2013 中還原服務應用程式。Summary: Learn how to restore a service application in SharePoint Server 2016 and SharePoint 2013.

您可以使用 SharePoint 管理中心網站或 Microsoft PowerShell 還原 SharePoint Server 中的服務應用程式。所使用的備份工具會視已部署的環境類型、備份排程需求以及與組織建立的服務等級協定而定。You can restore a service application in SharePoint Server by using the SharePoint Central Administration website or Microsoft PowerShell. Which backup tool you use depends on what kind of environment you have deployed, what your backup schedule requires, and what service level agreements you have made with your organization.

開始之前Before you begin

在某些情況下,您可能必須還原特定的服務應用程式,而不是還原整個伺服器陣列。某些服務應用程式 (如 Business Data Connectivity Service 應用程式及 User Profile Service 服務應用程式) 可對其他服務與網站提供資料。因此,使用者可能會在完成復原程序之前,遇到一些服務中斷情況。There are situations in which you might have to restore a specific service application instead of restoring the complete farm. Some service applications — for example, the Business Data Connectivity service application and the User Profile Service service application — provide data to other services and sites. As a result, users might experience some service interruption until the recovery process is completed.

開始這項作業之前,請檢閱下列有關如何還原服務應用程式的資訊:Before you begin this operation, review the following information about how to restore service applications:

  • 您不能備份某個版本的 SharePoint 然後還原成另一個版本的 SharePoint 。You cannot back up from one version of SharePoint and restore to another version of SharePoint.

  • SharePoint Server 會備份 Business Data Connectivity Service 中繼資料存放區,其中包括外部內容類型、外部系統及商務資料目錄模型。請注意,該產品不會備份外部資料來源。為了保護資料,必須備份外部資料來源。SharePoint Server backs up the Business Data Connectivity service metadata store, which includes external content types, external systems, and Business Data Catalog models. Note that this does not back up the external data sources. To protect the data, the external data sources must be backed up.

  • 如果您先還原服務應用程式或伺服器陣列,然後將資料來源還原至不同位置,則必須在外部內容類型定義中設定位置資訊。否則,Business Data Connectivity Service 可能會找不到資料來源。If you restore the service application or the farm and then restore the data source to a different location, you must configure 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 儲存時,SharePoint Server 才會還原遠端二進位大型物件 (BLOB) 存放區。如果您使用的是其他提供者,您必須手動還原遠端 BLOB 存放區。SharePoint Server restores remote Binary Large Object (BLOB) stores but only if you are using the FILESTREAM provider to put data in remote BLOB stores. If you are using another provider, you must manually restore remote BLOB stores.

  • 您無法使用 SQL Server 工具來還原整個服務應用程式,但可以還原與服務應用程式相關聯的資料庫。You cannot restore the complete service application by using SQL Server tools. However, you can restore the databases that are associated with the service application.

使用 PowerShell 還原 SharePoint Server 中的服務應用程式Use PowerShell to restore a service application in SharePoint Server

您可以使用 PowerShell 還原服務應用程式。You can use PowerShell to restore a service application.

使用 PowerShell 還原 Search 服務應用程式To restore a service application 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 系統管理員要求權限。If you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions.

      如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminFor additional information about PowerShell permissions, see Add-SPShellAdmin.

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

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

    Restore-SPFarm -Directory 
    <BackupFolder>
    -Item "
    <ServiceApplicationName>
    " -RestoreMethod Overwrite [-BackupId 
    <GUID>
    ] [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。<BackupFolder> is the path for the backup folder where the service application was backed up.

    • <ServiceApplicationName> 是服務應用程式的名稱。<ServiceApplicationName> is the name of the service application.

    • <GUID> 是要使用的備份識別碼。<GUID> is the ID of the backup to use.

      若要指定所使用的備份,請使用 BackupId 參數。您可以輸入下列命令檢視伺服器陣列的備份: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup。如果未指定 BackupId,則會使用最近一次的備份。您無法從僅有設定的備份還原服務應用程式。To specify which backup to use, use the BackupId parameter. You can view the backups for the farm by typing the following: Get-SPBackupHistory -Directory <BackupFolder> -ShowBackup. If you do not specify the BackupId, the most recent backup will be used. You cannot restore a service application from a configuration-only backup.

      若要還原所有服務應用程式,請在 PowerShell 命令提示字元處輸入下列命令:To restore all the service applications, at the PowerShell command prompt, type the following command:

    Restore-SPFarm -Directory 
    <BackupFolder>
    -Item "Farm\Shared Service Applications" -RestoreMethod Overwrite [-BackupId 
    <GUID>
    ] [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是備份服務應用程式的備份資料夾路徑。<BackupFolder> is the path for the backup folder where the service application was backed up.

    • <GUID> 是要使用的備份識別碼。<GUID> is the ID of the backup to use.

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

注意

建議您在執行命令列管理工作時使用 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.

使用管理中心還原 SharePoint Server 中的服務應用程式Use Central Administration to restore a service application in SharePoint Server

使用下列程序透過 SharePoint 管理中心網站還原服務應用程式。Use the following procedure to restore a service application by using the SharePoint Central Administration Web site.

使用 管理中心 還原 Search 服務應用程式To restore a service application 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. 啟動管理中心。Start Central Administration.

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

  4. 從 [從備份還原 - 步驟 3 之 1: 選取要還原的備份] 頁面的備份清單中,選取包含搜尋服務應用程式備份,或伺服器陣列層級的備份工作,然後按 [下一步]。只要按一下備份旁的 (+),即可檢視每項備份的詳細資訊。On the Restore from Backup — Step 1 of 3: Select Backup to Restore page, select the backup job that contains the service application backup, or a farm-level backup, from the list of backups, and then click Next. You can view more details about each backup by clicking the (+) next to the backup.

    注意

    若正確的備份作業未出現,請在 [備份目錄位置]**** 文字方塊中,輸入正確的備份資料夾路徑,然後按一下 [重新整理]*。您無法從只含設定的備份還原伺服器陣列。If the correct backup job does not appear, in the *Backup Directory Location text box, type the path of the correct backup folder, and then click Refresh. You cannot use a configuration-only backup to restore the farm.

  5. 在 [從備份還原 - 步驟 3 之 2: 選取要還原的元件] 頁面上,展開 [共用服務應用程式]*,選取服務應用程式旁的核取方塊,然後按 [下一步]。若要還原所有服務應用程式,請選取 [共用服務應用程式]*** 節點。On the Restore from Backup — Step 2 of 3: Select Component to Restore page, expand Shared Services Applications, select the check box that is next to the service application, and then click Next. To restore all the service applications, select the Shared Services Applications node.

  6. 在 [從備份還原 — 步驟 3 之 3:選取還原選項] 頁面上的 [還原元件]**** 區段中,確定 [還原下列元件]**** 清單中會出現 [Farm\Shared Services Applications\<服務應用程式>]****。On the Restore from Backup — Step 3 of 3: Select Restore Options page, in the Restore Component section, make sure that Farm\Shared Services Applications<Service application> appears in the Restore the following component list.

    在 [還原選項] 區段的 [還原的類型] 下,選取 [相同的設定] 選項。對話方塊會隨即出現,請您確認該作業。按一下 [確定]。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.

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

  7. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備] 區段中,檢視所有復原工作的一般狀態。在同頁面底部的 [還原] 區段中,則可檢視目前復原工作的狀態。狀態頁面每 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 a 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.

使用 SQL Server 工具還原與 SharePoint Server 中的服務應用程式相關聯的資料庫Use SQL Server tools to restore the databases associated with a service application in SharePoint Server

您不能使用 SQL Server 工具還原整個服務應用程式。不過,您可以使用 SQL Server 工具還原與服務應用程式相關聯的資料庫。若要還原整個服務應用程式,請使用 Microsoft PowerShell 或管理中心。You cannot restore the complete service application by using SQL Server tools. However, you can use SQL Server tools to restore the databases that are associated with the service application. To restore the complete service application, use either Microsoft PowerShell or Central Administration.

使用 SQL Server 工具還原服務應用程式的資料庫To restore the databases for a service application by using SQL Server tools

  1. 確認您要用於還原資料庫的使用者帳戶是否為儲存每個資料庫之資料庫伺服器上 sysadmin 固定伺服器角色的成員。Verify that the user account that you are using to restore the databases is a member of the sysadmin fixed server role on the database server where each database is stored.

  2. 開啟 SQL Server Management Studio 並連線至資料庫伺服器。Open SQL Server Management Studio and connect to the database server.

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

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

  5. 在 [還原資料庫] 對話方塊中的 [一般] 頁面上,從 [目的地資料庫] 下拉式清單中選取還原的目的地資料庫。In the Restore Database dialog box, on the General page, select the database to restore to from the To database drop-down list.

  6. 從 [從資料庫] 下拉式清單中選取還原的來源位置。Select the restore source from the From database drop-down list.

  7. 在 [選取要還原的備份集] 區域中,選取資料庫旁的核取方塊。In the Select the backup sets to restore section area, select the check box next to the database.

  8. 在 [選項] 索引標籤上,選取 [還原狀態]**** 區段的還原狀態。On the Options tab, select the recovery state from the Recover state section.

    如需該使用哪種復原類型的詳細資訊,請參閱《SQL Server 線上叢書》的<復原模式 (SQL Server)>。For more information about which recovery type to use, see Recovery Models (SQL Server) in SQL Server Books Online.

  9. 按一下 [確定]**** 還原資料庫。Click OK to restore the database.

  10. 針對與服務應用程式相關聯的每個資料庫重複步驟 1-9。Repeat steps 1-9 for each database that is associated with the service application.

另請參閱See also

概念Concepts

在 SharePoint Server 中備份服務應用程式Back up service applications in SharePoint Server