在 SharePoint Server 中備份 SharePoint 相關應用程式Back up apps for SharePoint in SharePoint Server

摘要: 了解如何在 SharePoint Server 2016 和 SharePoint 2013 中備份 SharePoint 的應用程式。Summary: Learn how to back up apps for SharePoint in SharePoint Server 2016 and SharePoint 2013.

建議您在伺服器陣列層級進行定期備份。但是,業務或 IT 需求除了一般伺服器陣列備份之外,可能需要您備份 SharePoint 應用程式。若您定期備份 SharePoint 應用程式環境,可減少因硬體故障、電力中斷或其他問題時發生資料遺失的機率。雖然這只是簡單的處理程序,但有助於在必要時可確保構成 SharePoint 應用程式環境的資料及設定能用於復原。We recommend that you regularly back up at the farm level. However, business or IT requirements might require you to back up the apps for SharePoint in addition to normal farm backups. If you regularly back up the apps for SharePoint environment, you reduce 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 data and configurations that compose the apps for SharePoint environment are available for recovery, if that is required.

SharePoint 相關應用程式 內容及套件均位於個別網站集合中的 SharePoint Server 內容資料庫。所有 SharePoint 相關應用程式 授權及安全性資料均儲存在 App Management Service 及 Secure Store Service 應用程式資料庫中。其他 SharePoint 相關應用程式 資料會以 Internet Information Services (IIS) 網站或 Web 應用程式及網頁組件套件的形式,儲存在 SharePoint Server 設定資料庫中。您必須同時備份下列 SharePoint Server 資料庫:The app for SharePoint content and packages are in the SharePoint Server content databases in individual site collections. All app for SharePoint license and security data is stored in the App Management Service and the Secure Store Service application databases. Additional app for SharePoint data is stored in the SharePoint Server configuration database, in the form of Internet Information Services (IIS) web sites or web applications, and Web Part packages. You must back up the following SharePoint Server databases at the same time:

  • 內容 - WSS_ContentContent - WSS_Content

  • 組態 - SharePoint_ConfigConfiguration - SharePoint_Config

  • Secure Store Service應用程式 - Secure_Store_Service_DB_<GUID>Secure Store Service application - Secure_Store_Service_DB_<GUID>

  • App Management Service 應用程式 - App_Management_<GUID>App Management service application - App_Management_<GUID>

若您最後需要還原資料庫,必須還原您所備份之每個資料庫的相同版本。換言之,請勿還原早於設定資料庫六個月的內容資料庫。If you have to eventually restore the databases, you have to restore the same version of each database that you backed up. In other words, don't restore a content database that's six months older than the configuration database.

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具備份 SharePoint 應用程式環境。You can back up an apps for SharePoint environment by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools.

備份內容資料庫Back up content databases

內容資料庫可儲存多個網站集合的資料。但您若有許多網站集合,則建議您新增足夠的內容資料庫,使每個資料庫的大小低於 200 GB,以最佳化系統效能。如需詳細資訊,請參閱<在 SharePoint Server 中備份內容資料庫>。Content databases can store data for multiple site collections. However, if you have many site collections, we recommend that you add enough content databases to keep the size of each database below 200 GB for optimal system performance. For more information, see Back up content databases in SharePoint Server.

注意

SharePoint Server 內容資料庫會變得很龐大。建議您將每個內容資料庫獨立於其他資料庫之外,個別進行處理備份,或是執行伺服器陣列備份。SharePoint Server content databases become very large. We recommend that you back up each content database as a separate process from other database or farm backups.

備份設定資料庫Back up the configuration database

SharePoint Server 設定資料庫儲存所有 SharePoint 資料庫及 Internet Information Services (IIS) 網站或 Web 應用程式的資料。包含信任的解決方案、網頁組件套件,網站範本與 Web 應用程式設定,以及指定給 SharePoint Server 的伺服器陣列設定,例如預設配額和封鎖的檔案類型。如需詳細資訊,請參閱<在 SharePoint Server 中備份伺服器陣列設定>。The SharePoint Server configuration database stores data about all SharePoint databases and Internet Information Services (IIS) web sites or web applications. This includes trusted solutions, web part packages, site templates, and web application settings, and farm settings that are specific to SharePoint Server, such as default quota and blocked file types. For more information, see Back up farm configurations in SharePoint Server.

備份 Secure Store Service 應用程式資料庫Back up the Secure Store Service application database

Secure Store Service 儲存及比對認證,例如帳戶名稱和密碼。若要備份 SharePoint 應用程式環境的 Secure Store 資料庫,請參閱<在 SharePoint Server 中備份 Secure Store Service>。The Secure Store Service database stores and maps credentials such as account names and passwords. To back up the Secure Store database for an apps for SharePoint environment, see Back up the Secure Store Service in SharePoint Server.

注意

當您備份 Secure Store 資料庫時,確保記下複雜密碼。您必須具有複雜密碼才能還原 Secure Store 資料庫。Make sure that you record the passphrase when you back up the Secure Store database. You must have the passphrase available to restore the Secure Store database.

備份 App Management Service 應用程式資料庫Back up the App Management service application database

App Management Service 應用程式資料庫會在 SharePoint Server 中,儲存從 應用程式目錄 網站下載之所有應用程式的應用程式授權和權限。若要備份應用程式管理資料庫,請遵循與大多數其他 SharePoint Server 服務應用程式相同的程序。如需詳細資訊,請參閱<在 SharePoint Server 中備份服務應用程式>。The App Management service application database stores the app licenses and permissions for all apps downloaded from the App Catalog site in SharePoint Server. To back up the App Management database, follow the same procedures as most other SharePoint Server service applications. For more information, see Back up service applications in SharePoint Server.

備份網站集合Back up a site collection

您在環境中可能具有裝載了 SharePoint 應用程式的多個網站集合。當您備份 SharePoint 應用程式時,必須也備份裝載應用程式的所有網站集合。You may have multiple site collections that host apps for SharePoint in your environment. When you backup apps for SharePoint you must also back up all site collections where the apps are hosted.

使用 PowerShell 備份網站集合To back up a site collection 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-SPSite -Identity <SiteCollectionGUIDorURL> -Path <BackupFile> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
    

    其中:Where:

    • <網站集合 GUID 或 URL> 是您要備份之網站集合的識別碼或 URL。<SiteCollectionGUIDorURL> is the ID or URL for the site collection you want to back up.

    • <備份檔案> 是備份檔案所在位置的路徑。<BackupFile> is the path of where the backup file is located.

      若要覆寫先前所使用的備份檔案,請使用 Force 參數。您可以使用 NoSiteLock 參數,不在備份進行期間,將網站集合設為唯讀。但若是使用此參數,使用者將可在備份期間變更網站集合,進而造成備份時的資料毀損。若要在 PowerShell 命令提示中顯示網站集合 GUID 或 URL,請輸入下列命令:If you want to overwrite a previously used backup file, use the Force parameter. You can use the NoSiteLock parameter to keep the read-only lock from being set on the site collection while it is being backed up. However, using this parameter can enable users to change the site collection while it is being backed up and could lead to possible data corruption during backup. To display the site collection GUID or URL at the PowerShell command prompt, type the following command:

    Get-SPSite | format-list -property id,url
    

    如果資料庫伺服器執行的是 SQL Server 的企業版,建議您同時使用 UseSqlSnapshot 參數,以提高備份的一致性。您也可以匯出這些快照中的網站或清單。If the database server is running an Enterprise Edition of SQL Server, we recommend that you also use the UseSqlSnapshot parameter for more consistent backups. You can also export sites or lists from these snapshots.

    注意

    如果您所用的 RBS 提供者不支援快照集,您就無法在內容部署或備份時使用快照集。例如,SQL FILESTREAM 提供者並不支援快照集。If the RBS provider that you are using does not support snapshots, you can't use snapshots for content deployment or backup. For example, the SQL FILESTREAM provider does not support snapshots.

    如需如何使用 SQL 快照的詳細資訊,請參閱在 SharePoint Server 中將資料庫備份至快照For more information about how to use SQL snap-shots, see Back up databases to snapshots in SharePoint Server.

    如需詳細資訊,請參閱<在 SharePoint Server 中備份網站集合>。For more details, see Back up site collections in SharePoint Server

    如需詳細資訊,請參閱<Backup-SPSite>。For more information, see Backup-SPSite.

注意

建議您在執行命令列管理工作時使用 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.

請參閱See also

概念Concepts

在 SharePoint Server 中規劃備份和修復Plan for backup and recovery in SharePoint Server

在 SharePoint Server 中還原 SharePoint 相關應用程式Restore apps for SharePoint in SharePoint Server