在 SharePoint Server 中還原 User Profile Service 應用程式Restore User Profile Service applications in SharePoint Server

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

您可以使用SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來還原 User Profile Service 應用程式。所使用的備份工具取決於已部署的環境類型、備份排程的需要以及您組織的服務等級協定而定。You can restore the User Profile Service application by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. 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.

重要

[!重要事項] 本文中的步驟適用於 SharePoint Server 2016。The steps in this article apply to SharePoint Server 2016.

開始之前Before you begin

本文描述如何還原 User Profile Service 應用程式,而不是還原整個伺服器陣列。This article describes how to restore the User Profile Service application instead of restoring the complete farm.

開始這項作業之前,請先檢閱下列如何還原 User Profile Service 應用程式的相關資訊:Before you begin this operation, review the following information about how to restore a User Profile service application:

  • User Profile Service 應用程式會提供資料給其他服務和網站。因此,在復原程序完成之前,使用者可能會碰到一些服務中斷的情形。The User Profile service application provides data to other services and sites. As a result, users might experience some service interruption until the recovery process is completed.

  • 您無法從某版的 SharePoint Server 備份,還原成其他版本的 SharePoint Server。You cannot back up from one version of SharePoint Server and restore to another version of SharePoint Server.

  • 如需如何同時還原伺服器陣列中所有服務應用程式的詳細資訊,請參閱在 SharePoint Server 中還原伺服器陣列For information about how to at the same time restore all the service applications in a farm, see Restore farms in SharePoint Server.

使用 PowerShell 在 SharePoint Server 中還原 User Profile Service 應用程式Using PowerShell to restore the User Profile service application in SharePoint Server

您可以使用 Microsoft PowerShell 還原 User Profile Service 應用程式。You can use Microsoft PowerShell to restore a User Profile service application.

使用 PowerShell 還原 User Profile Service 應用程式To restore the User Profile 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 系統管理員要求權限。如需 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 命令提示字元處,輸入下列命令:At the PowerShell command prompt, type the following command:

    Restore-SPFarm -Directory <BackupFolder> -Item Shared Services\Shared Services Applications\<ServiceApplicationName> -RestoreMethod Overwrite [-BackupId <GUID>] [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是儲存備份的資料夾路徑。<BackupFolder> is the path of the folder where the backups are stored.

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

    • <GUID> 是用於還原程序的備份識別碼。<GUID> is the identifier of the backup to use in the restore process.

      若不指定 BackupId,則會使用最近的備份。您無法從僅有設定的備份還原服務應用程式。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.

如需詳細資訊,請參閱<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.

使用 管理中心 還原 User Profile Service 應用程式至 SharePoint ServerUsing Central Administration to restore a User Profile service application in SharePoint Server

使用下列程序,以利用 SharePoint 管理中心 網站來還原 User Profile Service 應用程式。Use the following procedures to restore a User Profile service application by using the SharePoint Central Administration Web site.

使用管理中心還原 User Profile Service 應用程式To restore the User Profile 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.

    注意

    如果未顯示正確的備份工作,在 [備份目錄位置] 文字方塊中輸入正確的備份資料夾的路徑] 和 [重新整理。您無法使用僅限設定備份來還原 User Profile Service 服務應用程式。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 User Profile Service service application.

  5. 在 [從備份還原 - 步驟 3 之 2: 選取要還原的元件] 頁面上,展開 [共用服務應用程式],選取 User Profile Service 服務應用程式旁的核取方塊,然後按 [下一步]。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 User Profile Service service application, and then click Next.

  6. 在從備份還原-步驟 3 之 3: 選取還原選項] 頁面的 [還原元件] 區段中,確定Farm\Shared 服務應用程式\< User Profile Service 服務應用程式名稱>會出現在還原下列元件清單。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\<User Profile Service service application name> 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.

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

  8. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備] 區段中,檢視所有復原工作的一般狀態。在同頁面底部的 [還原] 區段中,則可檢視目前復原工作的狀態。狀態頁面每 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中來還原與 User Profile Service 應用程式相關聯的資料庫Using SQL Server tools to restore the databases associated with the User Profile service application in SharePoint Server

使用 SQL Server 工具無法還原完整的服務應用程式或服務應用程式 Proxy。不過,您可使用 SQL Server 工具來還原與服務應用程式相關聯的資料庫。若要還原完整的服務應用程式,請使用 PowerShell 或管理中心。You cannot restore the complete service application or service application proxy 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 PowerShell or Central Administration.

重要

[!重要事項] 如果您要還原使用者設定檔資料庫 (預設名稱為 User Profile Service_ProfileDB_ <GUID>),也必須還原社交資料庫 (預設名稱為 User Profile Service_SocialDB_ <GUID>)。失敗可能會導致 User Profile 資料不正確,因而很難偵測和和修正。If you are restoring the User Profile database (by default, it is named User Profile Service_ProfileDB_ <GUID>), you must also restore the Social database (by default, it is 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.

使用 SQL Server 工具還原與 User Profile Service 應用程式相關聯的資料庫To restore the databases associated with the User Profile service application by using SQL Server tools

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

  2. 啟動管理中心。Start Central Administration.

  3. 在 管理中心 中,按一下 [系統設定] 區段中的 [管理伺服器上的服務]。In Central Administration, in the System Settings section, click Manage services on server.

  4. 在 [伺服器上的服務] 頁面上,尋找 [User Profile Service]。如果該服務已啟動,請按一下 [停止],以停止服務。On the Services on Server page, find User Profile Service. If the service is started, click Stop to stop the service.

  5. 在還原 User Profile Service 服務應用程式資料庫之前,必須先匯入您在備份資料庫之前匯出的 Microsoft Identity Integration Server (MIIS) 加密金鑰。您只需要為還原程序執行一次此作業。若要執行此作業,請在要還原服務應用程式的伺服器上,於命令提示字元中輸入下列命令:Before you restore the User Profile Service service application databases, you must import the Microsoft Identity Integration Server (MIIS) encryption key that you exported before backing up the databases. You only have to do this one time for the restore process. To do this, on the server to which you are restoring the service application, type the following at the command prompt:

    miiskmu.exe /i exported.key {<GUID>}
    

    其中 <GIUD> 是金鑰的識別碼。Where <GIUD> is the identifier of the key.

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

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

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

  9. 在 [還原資料庫] 對話方塊中的 [選項] 頁面上,選取您要從 [還原狀態] 清單中執行的復原方式。In the Restore Database dialog box, on the Options page, select the kind of recovery that you want to perform from the Recovery state list.

    如需該使用何種復原類型的詳細資訊,請參閱復原模式 (SQL Server)For more information about which recovery type to use, see Recovery Models (SQL Server) .

  10. 在 [一般] 頁面上的 [還原的目的地] 區段中,從 [目的地資料庫] 清單中選取資料庫。On the General page, in the Destination for restore section, select the database from the To database list.

  11. 在 [還原的來源] 中,從 [來源資料庫] 清單中選取 [備份來源]。In the Source for restore section, select the backup source from the From database list.

  12. 或者,如果您已將備份檔移至另一台電腦,請選取 [來源裝置] 選項。如果正確的備份沒有列在 [選取要還原的備份組] 方塊中,請按一下省略符號按鈕,瀏覽至該檔案。Alternatively, if you have moved the backup files to another computer, select the From device option. If the correct backup is not listed in the Select the backup sets to restore box, browse to the file by clicking the ellipsis button.

  13. 從 [選取要還原的備份組] 方塊中,選取要還原的備份,然後按一下 [確定]。Select the backup to restore from the Select the backup sets to restore box, and then click OK.

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

  15. 針對與 User Profile Service 服務應用程式相關聯的下列資料庫 (列示名稱為預設名稱),重複步驟 5-11:Repeat steps 5-11 for the following databases associated with the User Profile Service service application (the names that are listed are the default names):

    • User Profile Service_ProfileDB_ <GUID>User Profile Service_ProfileDB_ <GUID>

    • User Profile Service_SocialDB_ <GUID>User Profile Service_SocialDB_ <GUID>

    • User Profile Service_SyncDB_ <GUID>User Profile Service_SyncDB_ <GUID>

  16. 在 管理中心 中,按一下 [系統設定] 區段中的 [管理伺服器上的服務]。In Central Administration, in the System Settings section, click Manage services on server.

  17. 在 [伺服器上的服務] 頁面上,尋找 [User Profile Service。如果該服務已停止,請按一下 [啟動],以啟動服務。On the Services on Server page, find User Profile Service. If the service is stopped, click Start to start the service.

另請參閱See also

概念Concepts

SharePoint Server 的還原解決方案Restore solutions in SharePoint Server

在 SharePoint Server 中備份 User Profile Service 應用程式Back up User Profile service applications in SharePoint Server

其他資源Other Resources

Windows PowerShell for SharePoint Server referenceWindows PowerShell for SharePoint Server reference