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

摘要: 了解如何備份 SharePoint Server 2016 和 SharePoint Server 2013中的 User Profile Service 服務應用程式。Summary: Learn how to back up the User Profile Service service application in SharePoint Server 2016 and SharePoint Server 2013.

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來備份 User Profile Service 應用程式。所使用的備份工具取決於已部署的環境類型、備份排程的需要以及您組織的服務等級協定而定。You can back up 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 與 SharePoint Server 2013。The steps in this article apply to only SharePoint Server 2016 and SharePoint Server 2013.

開始之前Before you begin

建議您定期在伺服器陣列層級進行備份。不過,商務或 IT 需求可能需要您對 User Profile Service 服務應用程式進行備份。定期備份 User Profile Service 服務應用程式,可減少因硬體故障、電力中斷或其他問題而發生資料遺失的可能性。此程序非常簡單,並且可協助確保所有服務應用程式相關資料及設定,可於必要時用於還原。We recommend that you regularly back up at the farm level. However, business or IT requirements might require you to back up the User Profile Service service application. Regularly backing up the User Profile service application reduces the possibility of data losses that might occur from hardware failures, power outages, or other problems. It is a simple process that helps make sure that all service application-related data and configurations are available for recovery, if that is required.

如需要備份哪些內容,以及要使用哪些工具的詳細資訊,請參閱在 SharePoint Server 中規劃備份和修復。您可以藉由備份整個伺服器陣列,以備份所有服務應用程式。如需詳細資訊,請參閱在 SharePoint Server 中備份伺服器陣列For information about what to back up and which tools to use, see Plan for backup and recovery in SharePoint Server. You can back up all the service applications in the farm by backing up the complete farm. For more information, see Back up farms in SharePoint Server.

開始這項作業之前,請先檢閱下列資訊:Before you begin this operation, review the following information:

  • 備份 User Profile Service 應用程式並不會影響伺服器陣列的狀態。不過,它確實需要資源。因此,執行備份時,備份該服務應用程式可能會影響伺服器陣列效能。您可以在伺服器陣列使用量最低的期間備份該服務應用程式,以避免發生效能問題。Backing up the User Profile service application does not affect the state of the farm. However, it does require resources. Therefore, backing up the service application might affect farm performance while the backup is running. You can avoid performance issues by backing up the service application during hours when farm use is lowest.

  • 您必須在本機電腦或網路上建立儲存備份的資料夾。若要獲得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。如需如何建立備份資料夾的詳細資訊,請參閱在 SharePoint Server 中準備備份及還原伺服器陣列You must create a folder on the local computer or the network in which to store the backups. For better performance, we recommend that you back up to the local computer and then move the backup files to a network folder. For more information about how to create a backup folder, see Prepare to back up and restore farms in SharePoint Server.

使用 PowerShell 備份 User Profile Service 應用程式Use PowerShell to back up a User Profile service application

您可以使用 PowerShell 手動備份 User Profile Service 應用程式,或是當作可依排程間隔執行之指令碼的一部分。You can use PowerShell to back the User Profile service application manually or as part of a script that can be run at scheduled intervals.

注意

第一次使用 PowerShell 來備份 User Profile Service 應用程式可能會失敗。如果發生這種情況,請再使用 PowerShell 執行備份程序一次。如需備份失敗的詳細資訊,請參閱備份目錄中的 spbackup.log 或 sprestore.log 檔案。Backup of a User Profile service application can fail the first time that you use PowerShell to perform the backup. If this occurs, repeat the backup procedure using PowerShell. For details about a backup failure, see the spbackup.log or sprestore.log files in the backup directory.

使用 PowerShell 備份 User Profile Service 服務應用程式To back up 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 2013 產品 Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint 2013 Products 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:

    Backup-SPFarm -Directory <BackupFolder> -BackupMethod Full -Item Farm\Shared Services\Shared Service Applications\<ServiceApplicationName> [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是您要用以儲存備份之本機電腦或網路上的資料夾路徑。<BackupFolder> is the path of a folder on the local computer or on the network in which you want to store the backups.

    • <服務應用程式名稱> 是您要備份之 User Profile Service 服務應用程式的名稱。<ServiceApplicationName> is the name of the User Profile Service service application that you want to back up.

      User Profile Service 服務應用程式一律需要完整備份。The User Profile Service service application always requires a full backup,

      注意

      User Profile Service 服務應用程式一律需要完整備份。The User Profile Service service application always requires a full backup,

  4. 您也必須備份服務應用程式 Proxy。若要執行這項操作,請在 PowerShell 命令提示字元處輸入下列命令:You must also back up the service application proxy. To do this, at the PowerShell command prompt, type the following command:

    Backup-SPFarm -Directory <BackupFolder> -BackupMethod Full -Item Farm\Shared Services\Shared Service Proxies\<ServiceApplicationProxyName > [-Verbose]
    

    其中:Where:

    • <BackupFolder> 是您要用以儲存備份之本機電腦或網路上的資料夾路徑。<BackupFolder> is the path of a folder on the local computer or on the network in which you want to store the backups.

    • <ServiceApplicationProxyName> 是您要備份之 User Profile Service 服務應用程式 Proxy 的名稱。<ServiceApplicationProxyName> is the name of the User Profile Service service application proxy that you want to back up.

如需詳細資訊,請參閱<Backup-SPFarm>。For more information, see Backup-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 應用程式Use Central Administration to back up a User Profile Service application

您可以使用管理中心備份 User Profile Service 應用程式。You can use Central Administration to back up the User Profile service application.

注意

第一次使用管理中心來備份 User Profile Service 應用程式可能會失敗。如果發生這種情況,請再使用管理中心執行備份程序一次。如需備份失敗的詳細資訊,請參閱備份目錄中的 spbackup.log 或 sprestore.log 檔案。Backup of a User Profile service application can fail the first time that you use Central Administration to perform the backup. If this occurs, repeat the backup procedure using Central Administration. For details about a backup failure, see the spbackup.log or sprestore.log files in the backup directory.

使用管理中心備份 User Profile Service 應用程式To back up 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 Perform a backup.

  4. 在 [執行備份 — 步驟 2 之 1:選取要備份的元件] 頁面上,從元件清單中選取 User Profile Service 服務應用程式,然後按 [下一步]*On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, select the User Profile Service service application from the list of components, and then click *Next.

  5. 在 [開始備份 — 步驟 2 之 2:選取備份選項] 頁面上,選取 [備份類型]**** 區段中的 [完整]*On the Start Backup — Step 2 of 2: Select Backup Options page, in the *Backup Type section, select Full.

    注意

    User Profile Service 應用程式一律需要完整備份。您必須使用 [完整]**** 選項。The User Profile service application always requires a full backup. You must use the Full option.

  6. 在 [備份檔案位置]**** 區段的 [備份位置]**** 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]*In the *Backup File Location section, in the Backup location box, type the path of the backup folder, and then click Start Backup.

  7. 您也必須備份服務應用程式 Proxy。若要這樣做,在管理中心首頁上,按一下 [備份與還原]**** 區段中的 [執行備份]****。You must also back up the service application proxy. To do this, in CentralAdmin_2nd, on the home page, in the Backup and Restore section, click Perform a backup.

  8. 在 [執行備份 — 步驟 2 之 1:選取要備份的元件] 頁面上,從元件清單中選取 User Profile Service 服務應用程式 Proxy,然後按 [下一步]*On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, select the User Profile Service service application proxy from the list of components, and then click *Next.

  9. 在 [開始備份 — 步驟 2 之 2:選取備份選項] 頁面上,選取 [備份類型]**** 區段中的 [完整]*On the Start Backup — Step 2 of 2: Select Backup Options page, in the *Backup Type section, select Full.

  10. 在 [備份檔案位置]**** 區段的 [備份位置]**** 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]*In the *Backup File Location section, in the Backup location box, type the path of the backup folder, and then click Start Backup.

  11. 您可以在 [備份與還原工作狀態] 頁面上方的 [整備] 區段中,檢視所有備份工作的一般狀態。在同頁面底部的 [備份] 區段中,則可檢視目前備份工作的狀態。狀態頁面每 30 秒會自動更新。只要按一下 [重新整理],即可手動更新狀態詳細資料。備份與復原都是計時器服務工作。因此,數秒之後才會開始備份。You can view the general status of all backup jobs at the top of the Backup and Restore Job Status page in the Readiness section. You can view the status for the current backup job in the lower part of the page in the Backup 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 backup to start.

    如有收到錯誤,可以檢閱 [備份與還原工作狀態] 頁面的 [失敗訊息] 欄。也可以在步驟 5 所指定之 UNC 路徑下的 Spbackup.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 Spbackup.log file at the UNC path that you specified in step 5.

使用 SQL Server 工具備份 User Profile Service 應用程式資料庫Use SQL Server tools to back up a User Profile service application database

您無法備份整個 User Profile Service 應用程式或服務應用程式 Proxy;您必須使用 PowerShell 或管理中心。不過,您可以備份與 User Profile Service 服務應用程式相關聯的所有資料庫。You cannot back up the whole User Profile service application or service application proxy. You must use either PowerShell or Central Administration. However, you can back up all the databases that are associated with the User Profile Service service application.

使用 SQL Server 備份 User Profile Service 應用程式資料庫To back up a User Profile service application database by using SQL Server

  1. 確認執行此程序的使用者帳戶是儲存各資料庫之資料庫伺服器上的 SQL Server db_backupoperator 固定資料庫角色成員。Verify that the user account that is performing this procedure is a member of the SQL Server db_backupoperator fixed database role on the database server where each database is stored.

  2. 在備份 User Profile Service 服務應用程式資料庫之前,必須先匯出 Microsoft Identity Integration Server Key (MIIS) 加密金鑰。您將會先匯入這個匯出的金鑰,再還原資料庫。根據預設,金鑰位於裝載了 Microsoft Forefront Identity Manager 服務之 SharePoint Server 2016伺服器中的下列目錄: <root directory drive> \Program Files\Microsoft Office Servers\16.0\Synchronization Service\Bin 或 <root directory drive> \Program Files\Microsoft Office Servers\15.0\Synchronization Service\Bin。若要匯出金鑰,請在命令提示字元處輸入下列命令:Before you back up the User Profile Service service application databases, you must export the Microsoft Identity Integration Server Key (MIIS) encryption key. You will import this exported key before you restore the databases. By default, the key is located on the server that runs SharePoint Server 2016 that is hosting the Microsoft Forefront Identity Manager services in the following directory: <root directory drive> \Program Files\Microsoft Office Servers\16.0\Synchronization Service\Bin or <root directory drive> \Program Files\Microsoft Office Servers\15.0\Synchronization Service\Bin. To export the key, type the following at the command prompt:

    miiskmu.exe
    

    使用 Microsoft Identity Integration Server Key Management Utility Wizard 匯出金鑰組。Use the Microsoft Identity Integration Server Key Management Utility Wizard to export the key set.

  3. 開啟 SQL Server Management Studio 並連線至資料庫伺服器。Open 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 back up, point to **Tasks, and then click **Back Up*.

  6. 在 [備份資料庫]**** 對話方塊中,確認資料庫名稱。In the Back Up Database dialog box, confirm the database name.

  7. 下一步,從 [備份類型]**** 清單選取要執行的備份種類。如需要使用哪種備份類型的詳細資訊,請參閱復原模式 (SQL Server)Next, select the kind of backup that you want to perform from the Backup type list. For more information about which backup type to use, see Recovery Models (SQL Server) http://go.microsoft.com/fwlink/p/?LinkID=715706&clcid=0x409.

  8. 在 [備份元件]**** 區域中,按一下 [資料庫]*In the *Backup component area, click Database.

  9. 在 [名稱]**** 文字方塊中,填入提供的預設名稱,或是另外指定備份組名稱。Either use the default name that is provided or specify a name for the backup set in the **Name **text box.

  10. 在 [目的地]**** 區域中,指定您要儲存備份的位置。In the Destination area, specify where you want to store the backup.

  11. 按一下 [確定]**** 備份資料庫。Click OK to back up the database.

  12. 請為每個 User Profile Service 應用程式資料庫重複執行步驟 1-10。Repeat steps 1-10 for each User Profile service application database.

另請參閱See also

概念Concepts

SharePoint Server 的備份解決方案Backup solutions in SharePoint Server

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

其他資源Other Resources

Windows PowerShell for SharePoint Server referenceWindows PowerShell for SharePoint Server reference