在 SharePoint Server 中備份內容資料庫Back up content databases in SharePoint Server

摘要: 了解如何備份 SharePoint Server 2016 和 SharePoint Server 2013 的單一內容資料庫。Summary: Learn how to back up a single content database in SharePoint Server 2016 and SharePoint Server 2013.

您可使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具備份內容資料庫。使用的備份工具取決於部署的環境類型、備份排程需求,以及您對組織所進行的服務等級協定而定。You can back up a content database by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. The backup tool that you use depends on the kind of environment that you have deployed, your backup schedule requires, and service level agreements that you have made with your organization.

開始之前Before you begin

SharePoint Server 內容資料庫可能會變得非常大。 因此,您可能想將其備份與伺服器陣列的備份分開進行。 透過定期備份內容資料庫,可減少可能由硬體故障、電力中斷或其他問題造成的資料遺失。此程序非常簡單,並且可協助確保所有資料在必要時都可用於復原。一次只能備份一個內容資料庫。SharePoint Server content databases can grow to be very large. Therefore, you might want to back them up separately from farm backups. Regularly backing up content databases reduces data losses that might occur from hardware failures, power outages, or other problems. It is a simple process and helps make sure that all the data is available for recovery, if that is required. You can only back up one content database at a time.

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

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

  • SharePoint Server 備份會備份遠端二進位大型物件 (BLOB) 存放區,但只有在您使用 SQL Filestream 遠端 BLOB 存放區提供者將資料放於遠端 BLOB 存放區時才會執行。SharePoint Server backup backs up remote Binary Large Objects (BLOB) stores but only if you are using the SQL Filestream remote BLOB store provider to place data in remote BLOB stores.

    如果您使用其他提供者,則必須手動備份遠端 BLOB 存放區。If you are using another provider you must manually back up these remote BLOB stores.

  • 如果您搭配使用 SQL Server 與透明資料加密 (TDE),而且使用 SharePoint 工具或 SQL Server 工具備份環境,則不會備份或還原 TDE 加密金鑰。您必須手動備份金鑰。還原時,您必須先手動還原金鑰,再還原資料。如需詳細資訊,請參閱<透明資料加密 (TDE)>。If you are using SQL Server with Transparent Data Encryption (TDE), and you are backing up your environment by using either SharePoint tools or SQL Server tools, the TDE encryption key in not backed up or restored. You must back up the key manually. When restoring, you must manually restore the key before restoring the data. For more information, see Transparent Data Encryption (TDE).

使用 PowerShell 備份 SharePoint Server 的內容資料庫Use PowerShell to back up a content database in SharePoint Server

您可使用 PowerShell 手動備份內容資料庫,或在排定的間隔中執行指令碼部分時進行備份。You can use PowerShell to back up a content database manually or as part of a script that can be run at scheduled intervals.

使用 PowerShell 備份內容資料庫To back up a content database 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:

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

    其中:Where:

    • <備份資料夾> 是備份資料夾的路徑。<BackupFolder> is the path of the backup folder.

    • <ContentDatabaseName> 是想要備份之資料庫的名稱。若要顯示內容資料庫的名稱,請在 PowerShell 命令提示字元處,輸入下列命令: Get-SPContentDatabase<ContentDatabaseName> is the name of the database that you want to back up. To display the name of the content database, type the following command at the PowerShell command prompt: Get-SPContentDatabase.

      若要檢視備份作業的進度,請使用 Verbose 參數。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>。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.

使用 管理中心 備份 SharePoint Server 的內容資料庫Use Central Administration to back up a content database in SharePoint Server

您可使用管理中心備份內容資料庫。You can use Central Administration to back up a content database.

使用 管理中心 備份內容資料庫To back up a content database 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: 選取要備份的元件] 頁面上,從元件清單中選取要備份的內容資料庫,然後按 [下一步]*On the Perform a Backup — Step 1 of 2: Select Component to Back Up page, select the content database that you want to back up from the list of components, and then click *Next.

    注意

    並非所有的內容資料庫都可在清單中選取。如果某個資料庫不可選取,則必須使用 PowerShell 備份內容資料庫。Not all content databases can be selected in the list. If a database is not selectable, you must use PowerShell to back up the content database.

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

    注意

    如果是第一次備份內容資料庫,您必須使用 [完整]**** 選項。必須先執行完整備份才可執行差異備份。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) 路徑,然後按一下 [開始備份]*In the *Backup File Location section, type the Universal Naming Convention (UNC) path of the backup folder, and then click Start Backup.

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

    如有收到錯誤,請檢閱 [備份與還原工作狀態] 頁面的 [失敗訊息]**** 欄。您也可以在步驟 5 所指定之 UNC 路徑下的 Spbackup.log 檔案中,找到詳細資料。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 的內容資料庫Use SQL Server tools to back up a content database in SharePoint Server

您可使用 SQL Server 工具備份內容資料庫。You can use SQL Server tools to back up a content database.

使用 SQL Server 工具備份內容資料庫To back up a content database by using SQL Server tools

  1. 確認執行此程序的使用者帳戶是要備份之所有資料庫上的 SQL Server db_owner 固定資料庫角色成員。Verify that the user account that is performing this procedure is a member of the SQL Server db_owner fixed database role on all databases that are to be backed up.

  2. 開啟 SQL Server Management Studio 並連線至正確的 SQL Server 資料庫引擎執行個體。Open SQL Server Management Studio and connect to the correct instance of the SQL Server Database Engine.

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

  4. 在要備份的資料庫上按一下滑鼠右鍵,並指向 [工作]*,然後按一下 [備份]Right-click the database that you want to back up, point to **Tasks, and then click **Back Up*.

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

  6. 下一步,從 [備份類型]**** 清單選取要執行的備份種類。如需要使用哪種備份類型的詳細資訊,請參閱<復原模式 (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.

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

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

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

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

  11. 針對每個內容資料庫重複步驟 1-10。Repeat steps 1-10 for each content database.

另請參閱See also

概念Concepts

在 SharePoint Server 中還原內容資料庫Restore content databases in SharePoint Server