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

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

您可以使用 SharePoint 管理中心網站、Microsoft PowerShell 或 SQL Server 工具還原 SharePoint 應用程式 環境。您使用的還原工具取決於已部署的環境類型、排程需求,以及組織的服務等級協定。You can restore an apps for SharePoint environment by using the SharePoint Central Administration website, Microsoft PowerShell, or SQL Server tools. The restore tool that you use depends on the kind of environment that you have deployed, your schedule requirements, and service level agreements that you have with your organization.

SharePoint 相關應用程式 內容及套件會儲存在個別網站集合中的 SharePoint Server 內容資料庫。還原程序會要求您還原應用程式參考的所有服務。SharePoint 應用程式 會參考下列您可能必須要還原的 SharePoint Server 資料庫。若您要將 SharePoint 應用程式 還原至相同環境,則應該也還原 SharePoint 相關應用程式 所在的網站集合。The app for SharePoint content and packages are stored in the SharePoint Server content databases in individual site collections. The restore process requires you to restore all services that the app references. The apps for SharePoint can reference the following SharePoint Server databases which you may have to restore. You should also restore the site collection where the app for SharePoint is located if you are restoring the apps for SharePoint to the same environment.

  • 內容Content

  • 組態Configuration

  • Secure Store Service 應用程式Secure Store Service application

  • App Management Service 應用程式App Management service application

開始之前Before you begin

內容資料庫可儲存多個網站集合的資料。若您在許多網站集合中有裝載 SharePoint 應用程式,就可能也有多個內容資料庫。若要備份及還原環境中的所有 SharePoint 應用程式,您必須備份及還原伺服器陣列中的所有內容資料庫及網站集合。Content databases can store data for multiple site collections. If you have apps for SharePoint hosted in many site collections you may also have multiple content databases. To back up and restore all of the apps for SharePoint in your environment, you must back up and restore all content databases and site collections in the farm.

還原內容資料庫Restore content databases

您可以一次還原單一內容資料庫或數個內容資料庫。如需如何還原伺服器陣列中之內容資料庫的資訊,請參閱<在 SharePoint Server 中還原內容資料庫>。如需如何同時備份及還原伺服器陣列中之所有內容資料庫的資訊,請參閱<在 SharePoint Server 中備份伺服器陣列>。You can restore a single content database or several content databases one at a time. For information about how to restore a content database in a farm, see Restore content databases in SharePoint Server. For information about how to back up and restore all the content databases in a farm at the same time, see Back up farms in SharePoint Server.

還原設定資料庫Restore the configuration database

在 SharePoint Server 中,您不需要還原設定資料庫,因為您可以直接還原伺服器陣列設定。如需詳細資訊,請參閱<在 SharePoint Server 中還原伺服器陣列設定>。In SharePoint Server you do not have to restore the configuration database because you can restore the farm configuration directly. For more information, see Restore farm configurations in SharePoint Server.

還原 Secure Store Service 應用程式資料庫Restore the Secure Store Service application database

Secure Store Service 資料庫會將認證儲存及對應至特定身分識別或一組身分識別。當 Secure Store Service 已備份時,您必須具有記下的複雜密碼才能進行還原。若要還原 Secure Store 資料庫,請參閱<在 SharePoint Server 中還原Secure Store Service 應用程式>。The Secure Store Service database stores and maps credentials to specific identities or a group of identities. You must have the passphrase that was recorded when the Secure Store Service was backed up to restore it. To restore the Secure Store database, see Restore Secure Store Service applications in SharePoint Server.

還原 App Management Service 應用程式資料庫Restore the App Management service application database

App Management Service 應用程式資料庫會在 SharePoint Server 中,儲存從 應用程式目錄 網站下載之所有應用程式的應用程式授權和權限。您必須還原此資料庫,才能確保可在您的伺服器陣列中取得 SharePoint 應用程式 授權和權限。若要還原 App Management 資料庫,請遵循與其他多數 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. You must restore this database to make sure that the apps for SharePoint licenses and permissions are available in your farm. To restore the App Management database, follow the same procedures as most other SharePoint Server service applications. For more information, see Restore service applications in SharePoint Server.

還原網站集合Restore a site collection

您僅能使用 PowerShell 在 SharePoint Server 中還原網站集合。使用本章節將包含 SharePoint 應用程式 的網站集合還原至相同的 SharePoint Server 環境。若要還原至新伺服器陣列,請參閱<將 SharePoint 應用程式還原至新伺服器陣列>。You can only restore a site collection in SharePoint Server by using PowerShell. Use this section to restore a site collection that contains apps for SharePoint to the same SharePoint Server environment. To restore to a new farm, see Restore apps for SharePoint to a new farm.

警告

任何包含了存在於網站集合備份複本上之遠端元件的 SharePoint 應用程式皆可能會造成問題。這是因為有兩個 SharePoint 相關應用程式的複本正在存取遠端連線,且可能會造成資訊公開或資料遺失。例如,實際執行環境中的網站集合,基於開發目的,由備份進行複製時,若沒有正確設計 SharePoint 相關應用程式,可能會無意間授與開發人員對遠端網站中實際執行資料的存取權。Any apps for SharePoint that contain remote components that are present on the backup copy of a site collection could cause problems. This is because two copies of the app for SharePoint are accessing the remote connection and can cause information disclosure or data loss. For example, when a site collection in a production environment is copied by a backup for a development purpose, this could unintentionally grant developers access to production data in remote sites if the app for SharePoint is not designed correctly.

使用 PowerShell 還原網站集合To restore 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:

    Restore-SPSite -Identity <SiteCollectionURL> -Path <Backup file> [-DatabaseServer <DatabaseServerName>] [-DatabaseName <ContentDatabaseName>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]
    

    其中:Where:

    • <SiteCollectionURL> 是要還原的網站集合 URL。<SiteCollectionURL> is URL for the site collection you want to restore.

    • <DatabaseServerName> 是網站集合所在的資料庫伺服器名稱。<DatabaseServerName> is name of the database server where the site collection resides.

    • <ContentDatabaseName> 是內容資料庫的名稱。<ContentDatabaseName> is the name of the content database.

      如果您要將網站集合還原至特定的內容資料庫,請使用 DatabaseServerDatabaseName 參數指定該內容資料庫。如果您不指定內容資料庫,則會將網站集合還原為 SharePoint Server 選擇的內容資料庫。If you want to restore the site collection to a specific content database, use the DatabaseServer and DatabaseName parameters to specify the content database. If you do not specify a content database, the site collection will be restored to a content database chosen by SharePoint Server.

      如果您要還原以主機命名的網站集合,請使用 Identity 參數指定以主機命名網站集合的 URL,並使用 HostHeader 參數,指定要保留主機名稱網站集合之 Web 應用程式的 URL。If you are restoring a host-named site collection, use the Identity parameter to specify the URL of the host-named site collection and use the HostHeader parameter to specify the URL of the web application that will hold the host-named site collection.

      如果您要覆寫現有的網站集合,請使用 Force 參數。If you want to overwrite an existing site collection, use the Force parameter.

      注意

      如果您要還原的網站集合等於或大於 1 GB,您可以使用 GradualDelete 參數,以在還原程序中獲得更好的效能。如果使用此參數,覆寫的網站集合將標記為已刪除,這樣可以立即防止繼續存取其內容。然後,計時器工作會逐步而不是同時地刪除已標記之網站集合中的資料,這可以減少對伺服器效能的影響。If the site collection that you are restoring is 1 gigabyte or larger, you can use the GradualDelete parameter for better performance during the restore process. When this parameter is used, the site collection that is overwritten is marked as deleted, which immediately prevents any additional access to its content. The data in the marked site collection is then deleted gradually over time by a timer job instead of all at the same time, which reduces the effect on server performance.

      如需詳細資訊,請參閱在 SharePoint Server 中還原網站集合For more information, see Restore site collections in SharePoint Server

      如需詳細資訊,請參閱<Restore-SPSite>。For more information, see Restore-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.

將 SharePoint 應用程式還原至新伺服器陣列Restore apps for SharePoint to a new farm

若要將 SharePoint 應用程式還原至新伺服器陣列,您必須將應用程式參考的所有服務加以備份與還原。這些 SharePoint Server 服務應用程式可能包含 Secure Store Service 服務應用程式、SharePoint 的 Access Services 及應用程式管理服務。如需詳細資訊,請參閱下列文章:To restore apps for SharePoint to a new farm you must also backup and restore any services that the app references. These SharePoint Server service applications can include the Secure Store Service service application, Access Services in SharePoint, and the App Management Service. For more information, see the following articles:

另請參閱See also

概念Concepts

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

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

在 SharePoint Server 中還原網站集合Restore site collections in SharePoint Server