在 SharePoint Server 中備份內容資料庫

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

您可使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具備份內容資料庫。 使用的備份工具取決於部署的環境類型、備份排程需求,以及您對組織所進行的服務等級協定而定。

開始之前

SharePoint Server 內容資料庫可能會變得非常大。 因此,您可能想將其備份與伺服器陣列的備份分開進行。 透過定期備份內容資料庫,可減少可能由硬體故障、電力中斷或其他問題造成的資料遺失。 此程序非常簡單,並且可協助確保所有資料在必要時都可用於復原。 一次只能備份一個內容資料庫。

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

  • 您必須在本機電腦或網路上建立儲存備份的資料夾。 若要獲得較佳的效能,建議您備份至本機電腦,然後再將備份檔案移至網路資料夾。

  • SharePoint Server 備份會備份遠端二進位大型物件 (BLOB) 存放區,但只有在您使用 SQL Filestream 遠端 BLOB 存放區提供者將資料放於遠端 BLOB 存放區時才會執行。

    如果您使用其他提供者,則必須手動備份遠端 BLOB 存放區。

  • 如果您搭配使用 SQL Server 與透明資料加密 (TDE),而且使用 SharePoint 工具或 SQL Server 工具備份環境,則不會備份或還原 TDE 加密金鑰。 您必須手動備份金鑰。 還原時,您必須先手動還原金鑰,再還原資料。 如需詳細資訊,請參閱<透明資料加密 (TDE)>。

使用 PowerShell 備份 SharePoint Server 的內容資料庫

您可使用 PowerShell 手動備份內容資料庫,或在排定的間隔中執行指令碼部分時進行備份。

使用 PowerShell 備份內容資料庫

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

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

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

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

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

    注意事項

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

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

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

    Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} -Item <ContentDatabaseName> [-Verbose]
    

    其中:

    • <備份資料夾> 是備份資料夾的路徑。

    • <ContentDatabaseName> 是想要備份之資料庫的名稱。 若要顯示內容資料庫的名稱,請在 PowerShell 命令提示字元中輸入下列命令: Get-SPContentDatabase

    To view the progress of the backup operation, use the Verbose parameter.

    注意事項

    If you are backing up the content database for the first time, you must use the Full option. You must perform a full backup before you can perform a differential backup.

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

注意事項

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

使用 管理中心 備份 SharePoint Server 的內容資料庫

您可使用管理中心備份內容資料庫。

使用 管理中心 備份內容資料庫

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

  2. 啟動管理中心。

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

  4. 在 [執行備份 - 步驟 2 之 1: 選取要備份的元件] 頁面上,從元件清單中選取要備份的內容資料庫,然後按 [下一步]

    注意事項

    [!附註] 並非所有的內容資料庫都可在清單中選取。 如果某個資料庫不可選取,則必須使用 PowerShell 備份內容資料庫。

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

    注意事項

    If you are backing up the content database for the first time, you must use the Full option. You must perform a full backup before you can perform a differential backup.

  6. 在 [備份檔案位置] 區段中,輸入備份資料夾的通用命名慣例 (UNC) 路徑,然後按一下 [開始備份]。

  7. 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 of 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, review 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 工具備份 SharePoint Server 的內容資料庫

您可使用 SQL Server 工具備份內容資料庫。

使用 SQL Server 工具備份內容資料庫

  1. 確認執行此程序的使用者帳戶是要備份之所有資料庫上的 SQL Server db_owner 固定資料庫角色成員。

  2. 開啟 SQL Server Management Studio 並連線至正確的 SQL Server 資料庫引擎執行個體。

  3. In Object Explorer, expand Databases.

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

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

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

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

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

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

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

  11. 針對每個內容資料庫重複步驟 1-10。

另請參閱

概念

在 SharePoint Server 中還原內容資料庫