於 AlwaysOn 次要資料庫啟動資料移動 (SQL Server)Start Data Movement on an Always On Secondary Database (SQL Server)

適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions) 適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions)

本主題描述在將資料庫加入 AlwaysOn 可用性群組之後如何啟動資料同步處理。This topic contains information about how to start data synchronization after you add a database to an Always On availability group. 對於每個新的主要複本,必須在裝載次要複本的伺服器執行個體上準備次要資料庫。For each new primary replica, secondary databases must be prepared on the server instances that host the secondary replicas. 然後每個次要資料庫必須手動聯結至可用性群組。Then each of these secondary databases must be manually joined to the availability group.

注意

如果在裝載可用性群組之可用性複本的每個伺服器執行個體上檔案路徑都相同, [新增可用性群組精靈][將複本加入至可用性群組精靈][將資料庫加入至可用性群組精靈] 可能會自動為您啟動資料同步處理。If the file paths are identical on every server instance that hosts an availability replica for an availability group, the New Availability Group Wizard, Add Replica to Availability Group Wizard, or Add Database to Availability Group Wizard might be able to automatically start data synchronization for you.

若要手動啟動資料同步處理,您需要依次連接到裝載此可用性群組之次要複本的每個伺服器執行個體,並完成下列步驟:To start data synchronization manually, you need to connect, in turn, to each server instance that is hosting a secondary replica for the availability group and complete the following steps:

  1. 還原每個主要資料庫及其交易記錄的目前備份 (使用 RESTORE WITH NORECOVERY)。Restore current backups of each primary database and its transaction log (using RESTORE WITH NORECOVERY). 您可以使用下列其中一種替代方法:You can use either of the following alternative approaches:

    • 使用 RESTORE WITH NORECOVERY,手動還原主要資料庫的最近資料庫備份,然後使用 RESTORE WITH NORECOVERY,還原每個後續的記錄備份。Manually restore a recent database backup of the primary database using RESTORE WITH NORECOVERY, and then restore each subsequent log backup using RESTORE WITH NORECOVERY. 在裝載可用性群組之次要複本的每個伺服器執行個體上,執行此還原順序。Perform this restore sequence on every server instance that hosts a secondary replica for the availability group.

      如需詳細資訊:<>For more information:

      針對可用性群組手動準備次要資料庫 (SQL Server)Manually Prepare a Secondary Database for an Availability Group (SQL Server)

    • 如果您要將一或多個記錄傳送主要資料庫加入可用性群組,您可能可以從記錄傳送將一或多個對應的次要資料庫移轉至 AlwaysOn 可用性群組。If you are adding one or more log shipping primary databases to an availability group, you might be able to migrate one or more of the corresponding secondary databases from log shipping to Always On Availability Groups. 移轉記錄傳送次要資料庫會要求該資料庫使用與主要資料庫相同的資料庫名稱,以及該資料庫位於主控可用性群組之次要複本的伺服器執行個體上。Migrating a log shipping secondary database requires that it use the same database name as the primary database and that it reside on a server instance that is hosting a secondary replica for the availability group. 此外,可用性群組必須設定,才能以主要複本做為備份的優先考量,並且適合用於執行備份 (也就是說,它的備份優先權為 >0)。Furthermore, the availability group must be configured so that the primary replica is preferred for backups and is a candidate for performing backups (that is, that has a backup priority that is >0). 備份作業在主要資料庫上執行之後,您將需要停用備份作業;還原作業在指定的次要資料庫上執行之後,您將需要停用還原作業。Once the backup job has run on the primary database, you will need to disable the backup job, and once the restore job has run on a given secondary database, you will need to disable the restore job.

      注意

      為可用性群組建立所有次要資料庫之後,如果您想要在次要複本上執行備份,則需要重新設定可用性群組的自動備份喜好設定。After you have created all the secondary databases for the availability group, if you want to perform backups on secondary replicas, you will need to re-configure the automated backup preference of the availability group.

      如需詳細資訊:<>For more information:

      從記錄傳送移轉至 AlwaysOn 可用性群組的必要條件 (SQL Server)Prerequisites for Migrating from Log Shipping to Always On Availability Groups (SQL Server)

      設定可用性複本的備份 (SQL Server)Configure Backup on Availability Replicas (SQL Server)

  2. 盡快將每個新備妥的次要資料庫聯結至可用性群組。As soon as possible, join each newly prepared secondary database to the availability group.

    如需詳細資訊:<>For more information:

    將次要資料庫聯結至可用性群組 (SQL Server)Join a Secondary Database to an Availability Group (SQL Server)

另請參閱See Also

AlwaysOn 可用性群組概觀 (SQL Server)Overview of Always On Availability Groups (SQL Server)