在 SharePoint Server 中備份 User Profile Service 應用程式

適用于:yes-img-132013 yes-img-16 2016yes-img-192019 yes-img-se訂閱版本 no-img-sopMicrosoft 365 中的 SharePoint

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具來備份 User Profile Service 應用程式。 所使用的備份工具取決於已部署的環境類型、備份排程的需要以及您組織的服務等級協定而定。

重要事項

本文中的步驟僅適用于 SharePoint Server 2019、2016 和 2013。

開始之前

建議您定期在伺服器陣列層級進行備份。 不過,商務或 IT 需求可能需要您對 User Profile Service 服務應用程式進行備份。 定期備份 User Profile Service 服務應用程式,可減少因硬體故障、電力中斷或其他問題而發生資料遺失的可能性。 此程序非常簡單,並且可協助確保所有服務應用程式相關資料及設定,可於必要時用於還原。

如需要備份哪些內容,以及要使用哪些工具的詳細資訊,請參閱在 SharePoint Server 中規劃備份和修復。 您可以藉由備份整個伺服器陣列,以備份所有服務應用程式。 如需詳細資訊,請參閱在 SharePoint Server 中備份伺服器陣列

開始這項作業之前,請先檢閱下列資訊:

  • 備份 User Profile Service 應用程式並不會影響伺服器陣列的狀態。 不過,它確實需要資源。 因此,執行備份時,備份該服務應用程式可能會影響伺服器陣列效能。 您可以在伺服器陣列使用量最低的期間備份該服務應用程式,以避免發生效能問題。

  • 您必須在本機電腦或網路上建立儲存備份的資料夾。 若要取得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。 如需如何建立備份資料夾的詳細資訊,請參閱在 SharePoint Server 中準備備份及還原伺服器陣列

使用 PowerShell 備份 User Profile Service 應用程式

您可以使用 PowerShell 手動備份 User Profile Service 應用程式,或是當作可依排程間隔執行之指令碼的一部分。

注意事項

[!附註] 第一次使用 PowerShell 來備份 User Profile Service 應用程式可能會失敗。 如果發生這種情況,請再使用 PowerShell 執行備份程序一次。 如需備份失敗的詳細資訊,請參閱備份目錄中的 spbackup.log 或 sprestore.log 檔案。

使用 PowerShell 備份 User Profile Service 服務應用程式

  1. 確認您具備下列成員身分:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。

    系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint 2013 產品 Cmdlet 的權限。

    注意事項

    [!附註] 如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。 如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdmin

  2. 啟動 SharePoint 管理命令介面。

  3. 在 PowerShell 命令提示字元中,輸入下列命令:

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

    其中:

    • <BackupFolder> 是您要用以儲存備份之本機電腦或網路上的資料夾路徑。

    • <服務應用程式名稱>是您要備份之 User Profile Service 服務應用程式的名稱。

    注意事項

    User Profile Service 服務應用程式一律需要完整備份。

  4. 您也必須備份服務應用程式 Proxy。 若要執行這項操作,請在 PowerShell 命令提示字元處輸入下列命令:

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

    其中:

    • <BackupFolder> 是您要用以儲存備份之本機電腦或網路上的資料夾路徑。

    • <ServiceApplicationProxyName> 是您要備份之 User Profile Service 服務應用程式 Proxy 的名稱。

如需詳細資訊,請參閱<Backup-SPFarm>。

注意事項

[!附註] 建議您在執行命令列管理工作時使用 Windows PowerShell。 Stsadm 命令列工具已過時,但為與舊版產品相容,仍會隨附提供。

使用管理中心備份 User Profile Service 應用程式

您可以使用管理中心備份 User Profile Service 應用程式。

注意事項

[!附註] 第一次使用管理中心來備份 User Profile Service 應用程式可能會失敗。 如果發生這種情況,請再使用管理中心執行備份程序一次。 如需備份失敗的詳細資訊,請參閱備份目錄中的 spbackup.log 或 sprestore.log 檔案。

使用管理中心備份 User Profile Service 應用程式

  1. 確認執行此程序的使用者帳戶為 SharePoint 伺服器陣列管理員群組的成員。

  2. 啟動 [管理中心]

  3. 在管理中心首頁上,按一下 [備份與還原] 區段中的 [執行備份]

  4. 在 [執行備份 — 步驟 2 之 1:選取要備份的元件] 頁面上,從元件清單中選取 User Profile Service 服務應用程式,然後按 [下一步]

  5. 在 [開始備份 — 步驟 2 之 2:選取備份選項] 頁面上,選取 [備份類型] 區段中的 [完整]

    注意事項

    The User Profile service application always requires a full backup. You must use the Full option.

  6. 在 [備份檔案位置] 區段的 [備份位置] 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]

  7. You must also back up the service application proxy. To do this, in Central Administration, on the home page, in the Backup and Restore section, click Perform a backup.

  8. 在 [執行備份 — 步驟 2 之 1:選取要備份的元件] 頁面上,從元件清單中選取 User Profile Service 服務應用程式 Proxy,然後按 [下一步]

  9. 在 [開始備份 — 步驟 2 之 2:選取備份選項] 頁面上,選取 [備份類型] 區段中的 [完整]

  10. 在 [備份檔案位置] 區段的 [備份位置] 方塊中,輸入備份資料夾的路徑,然後按一下 [開始備份]

  11. 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.

    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 應用程式資料庫

您無法備份整個 User Profile Service 應用程式或服務應用程式 Proxy。 您必須使用 PowerShell 或管理中心。 不過,您可以備份與 User Profile Service 服務應用程式相關聯的所有資料庫。

使用 SQL Server 備份 User Profile Service 應用程式資料庫

  1. 確認執行此程序的使用者帳戶是儲存各資料庫之資料庫伺服器上的 SQL Server db_backupoperator 固定資料庫角色成員。

  2. 在備份 User Profile Service 服務應用程式資料庫之前,必須先匯出 Microsoft Identity Integration Server Key (MIIS) 加密金鑰。 您將會先匯入這個匯出的金鑰,再還原資料庫。 根據預設,金鑰位於執行 SharePoint Server 2016 的伺服器上,該伺服器裝載下列目錄中的 Microsoft Forefront Identity Manager 服務:< 根目錄磁片磁碟機 >\Program Files\Microsoft Office Servers\16.0\Synchronization Service\Bin 或< 根目錄磁片磁碟機 >\Program Files\Microsoft Office Server\15.0\Synchronization Service\Bin。 若要匯出金鑰,請在命令提示字元處輸入下列命令:

    miiskmu.exe
    

    使用 Microsoft Identity Integration Server Key Management Utility Wizard 匯出金鑰組。

  3. 開啟 SQL Server Management Studio 並連線至資料庫伺服器。

  4. In Object Explorer, expand Databases.

  5. 在要備份的資料庫上按一下滑鼠右鍵,並指向 [工作],然後按一下 [備份]

  6. 在 [ 備份資料庫 ] 對話方塊中,確認資料庫名稱。

  7. 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).

  8. 在 [備份元件] 區域中,按一下 [資料庫]

  9. 在 [名稱] 文字方塊中,填入提供的預設名稱,或是另外指定備份組名稱。

  10. 在 [目的地] 區域中,指定您要儲存備份的位置。

  11. 按一下 [確定] 備份資料庫。

  12. 請為每個 User Profile Service 應用程式資料庫重複執行步驟 1-10。

另請參閱

概念

SharePoint Server 的備份解決方案

在 SharePoint Server 中還原服務應用程式

其他資源

Windows PowerShell for SharePoint Server reference