|
| 1 | +--- |
| 2 | +title: Upgrade or Patch Peer-to-Peer Replicated Databases |
| 3 | +description: SQL Server supports upgrading Peer-to-Peer replicated databases from previous versions of SQL Server without stopping activity on other peers. |
| 4 | +author: asavioliMSFT |
| 5 | +ms.author: akbarf |
| 6 | +ms.reviewer: jopilov, mathoma |
| 7 | +ms.date: 12/12/2025 |
| 8 | +ms.service: sql |
| 9 | +ms.subservice: install |
| 10 | +ms.topic: upgrade-and-migration-article |
| 11 | +helpviewer_keywords: |
| 12 | + - "peer-to-peer replication database upgrades [SQL Server replication]" |
| 13 | + - "replication [SQL Server], upgrading upgrade-peer-to-peer-replication.md" |
| 14 | + - "transactional replication, upgrading databases" |
| 15 | + - "p2p replication [SQL Server], upgrading databases" |
| 16 | + - "upgrading replicated databases" |
| 17 | +monikerRange: ">=sql-server-2016" |
| 18 | +--- |
| 19 | + |
| 20 | +# Upgrade or patch peer-to-peer replicated databases |
| 21 | + |
| 22 | +[!INCLUDE [SQL Server -Windows Only](../../includes/applies-to-version/sql-windows-only.md)] |
| 23 | + |
| 24 | +This article provides guidance on how to upgrade or patch SQL Server instances that participate in [peer-to-peer (P2P) replication](../../relational-databases/replication/transactional/peer-to-peer-transactional-replication.md), both outside of an Always On availability group and for databases that are within an Always On availability group. |
| 25 | + |
| 26 | +If your replication topology includes other types of replication, such as snapshot, merge or transactional replication, see [Upgrade or patch replicated databases](upgrade-replicated-databases.md) for more information. |
| 27 | + |
| 28 | +## Upgrade P2P databases outside of an availability group |
| 29 | + |
| 30 | +The steps in this section provide guidance on how to upgrade or patch SQL Server instances that are participating in peer-to-peer (P2P) replication outside of an Always On availability group. |
| 31 | + |
| 32 | +The following table describes the roles and names of the servers that participate in the replication topology used in the example: |
| 33 | + |
| 34 | +| Name | Role | |
| 35 | +| --- | --- | |
| 36 | +| **Peer1** | The SQL Server instance that hosts the replication databases for the first peer in the peer-to-peer topology. | |
| 37 | +| **Peer2** | The SQL Server instance that hosts the replication databases for the second peer in the peer-to-peer topology. | |
| 38 | +| **Dist1** | The remote distributor for Peer1. | |
| 39 | +| **Dist2** | The remote distributor for Peer2. | |
| 40 | + |
| 41 | +When patching or upgrading peer-to-peer replicated databases outside of an availability group, follow these steps: |
| 42 | +1. Stop incoming traffic to **Peer2** by stopping all applications and distribution agents from any other peers that replicate to this instance. For example, stop the distribution agent on **Peer1**. |
| 43 | +1. Confirm there are no pending replicated transactions coming to **Peer2** by checking the log reader agents and distribution agents associated with this replication topology. |
| 44 | +1. If the distributor is remote, first upgrade the remote distributor **Dist2**. If the distributor is the local **Peer2** instance, skip to the next step. |
| 45 | +1. Upgrade the instance **Peer2**. |
| 46 | +1. Start the distribution agent from **Peer1** (or any remaining peers replicating to this peer). |
| 47 | +1. Stop incoming traffic to **Peer1** by stopping all applications and distribution agents from any other peers that replicate to this instance. For example, stop the distribution agent on **Peer2**. |
| 48 | +1. Confirm there are no pending replicated transactions coming to **Peer1** by checking the log reader agents and distribution agents associated with this replication topology. |
| 49 | +1. If the distributor is remote, first upgrade the remote distributor **Dist1**. If the distributor is the local **Peer1** instance, skip to the next step. |
| 50 | +1. Upgrade the instance **Peer1**. |
| 51 | +1. Start the distribution agent from **Peer2** (or any remaining peers replicating to this peer). |
| 52 | +1. If there are any other peers in the topology, repeat these same steps for each peer. |
| 53 | + |
| 54 | +## Upgrade P2P databases in an availability group |
| 55 | + |
| 56 | +The steps in this section provide guidance on how to upgrade or patch SQL Server instances that are participating in peer-to-peer (P2P) replication within an Always On availability group. |
| 57 | + |
| 58 | +The following table describes the roles and names of the servers that participate in the replication topology used in the example: |
| 59 | + |
| 60 | +| Name | Role | |
| 61 | +| --- | --- | |
| 62 | +| **Peer1N1** | The SQL Server instance that hosts the primary replica, and is **Peer1** in the peer-to-peer topology. | |
| 63 | +| **Peer1N2** | The SQL Server instance that hosts the secondary replica associated with **Peer1** in the peer-to-peer topology. | |
| 64 | +| **Dist1** | The remote distributor for **Peer1**. | |
| 65 | +| **Peer2N3** | The SQL Server instance that hosts the primary replica, and is **Peer2** in the peer-to-peer topology. | |
| 66 | +| **Peer2N4** | The SQL Server instance that hosts the secondary replica associated with **Peer2** in the peer-to-peer topology. | |
| 67 | +| **Dist2** | The remote distributor for **Peer2**. | |
| 68 | + |
| 69 | +> [!NOTE] |
| 70 | +> Using a local distributor for a P2P database that is part of an availability group isn't a recommended configuration, as it's a single point of failure. |
| 71 | +
|
| 72 | +When patching or upgrading peer-to-peer replicated databases within an availability group, follow these steps: |
| 73 | +1. Stop incoming traffic to **Peer2** by stopping all applications and distribution agents from any other peers that replicate to this instance. For example, stop the distribution agent on **Peer1**. |
| 74 | +1. Confirm there are no pending replicated transactions coming to **Peer2** by checking the log reader agents and distribution agents associated with this replication topology. |
| 75 | +1. Upgrade the remote distributor for **Peer2**, **Dist2**, by following the sequence in [Upgrade availability group replicas](../availability-groups/windows/upgrading-always-on-availability-group-replica-instances.md). If your distributor is local, skip to the next step. |
| 76 | +1. Upgrade the secondary replica **Peer2N4**. |
| 77 | +1. Perform a failover of the availability group from the current primary replica **Peer2N3** to the upgraded secondary **Peer2N4**. |
| 78 | +1. Upgrade the former primary replica **Peer2N3**. |
| 79 | +1. Perform a failover of the availability group from the current primary **Peer2N4** to the previous primary replica **Peer2N3**. |
| 80 | +1. Start the distribution agent from **Peer1** (or any remaining peers replicating to this peer). |
| 81 | +1. Stop incoming traffic to **Peer1** by stopping all applications and distribution agents from any other peers that replicate to this instance. For example, stop the distribution agent on **Peer2**. |
| 82 | +1. Confirm there are no pending replicated transactions coming to **Peer1** by checking the log reader agents and distribution agents associated with this replication topology. |
| 83 | +1. Upgrade the remote distributor for **Peer1**, **Dist1**, by following the sequence in [Upgrade availability group replicas](../availability-groups/windows/upgrading-always-on-availability-group-replica-instances.md). If your distributor is local, skip to the next step. |
| 84 | +1. Upgrade the secondary replica **Peer1N2**. |
| 85 | +1. Perform a failover of the availability group from the current primary replica **Peer1N1** to the upgraded secondary **Peer1N2**. |
| 86 | +1. Upgrade the former primary replica **Peer1N1**. |
| 87 | +1. Perform a failover of the availability group from the current primary **Peer1N2** to the previous primary replica **Peer1N1**. |
| 88 | +1. Start the distribution agent from **Peer2** (or any remaining peers replicating to this peer). |
| 89 | +1. If there are any other peers in the topology, repeat these same steps for each peer. |
| 90 | + |
| 91 | +## Related content |
| 92 | + |
| 93 | +- [SQL Server Replication](../../relational-databases/replication/sql-server-replication.md) |
| 94 | +- [Upgrade or patch replicated databases](upgrade-replicated-databases.md) |
| 95 | +- [Replication Administration FAQ](../../relational-databases/replication/administration/frequently-asked-questions-for-replication-administrators.yml) |
| 96 | +- [Replication backward compatibility](../../relational-databases/replication/replication-backward-compatibility.md) |
| 97 | +- [Supported version and edition upgrades (SQL Server 2022)](supported-version-and-edition-upgrades-2022.md) |
| 98 | +- [Upgrade SQL Server](upgrade-sql-server.md) |
| 99 | +- [Upgrade availability group replicas](../availability-groups/windows/upgrading-always-on-availability-group-replica-instances.md) |
0 commit comments