Skip to content

Commit

Permalink
moving another article
Browse files Browse the repository at this point in the history
  • Loading branch information
MashaMSFT committed May 15, 2020
1 parent 46c6a4b commit ee6f78f
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 5 deletions.
2 changes: 1 addition & 1 deletion azure-sql/database/how-to-content-reference-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ In this article you can find a content reference of various guides, scripts, and
- [Remove TDE protector](transparent-data-encryption-byok-remove-tde-protector.md)
- [Configure In-Memory OLTP](../in-memory-oltp-migration.md)
- [Configure Azure Automation](automation-manage.md)
- [Configure transactional replication](../../sql-database/replication-to-sql-database.md) to replicate your date between databases.
- [Configure transactional replication](replication-to-sql-database.md) to replicate your date between databases.
- [Configure threat detection](threat-detection.md) to let Azure SQL Database identify suspicious activities such as SQL Injection or access from suspicious locations.
- [Configure dynamic data masking](dynamic-data-masking-configure-portal.md) to protect your sensitive data.
- [Configure backup retention](long-term-backup-retention-configure.md) for a database to keep your backups on Azure Blob Storage.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions azure-sql/database/replication-to-sql-database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
title: SQL Server replication to Azure SQL Database
description: You can configure an Azure SQL Database as the push subscriber in a one-way transactional or snapshot replication topology.
services: sql-database
ms.service: sql-database
ms.subservice: data-movement
ms.custom: seo-lt-2019, sqldbrb=1
ms.devlang:
ms.topic: conceptual
author: stevestein
ms.author: sstein
ms.reviewer: mathoma
ms.date: 04/28/2020
---
# Replication to Azure SQL Database

You can configure an Azure SQL Database as the push subscriber in a one-way transactional or snapshot replication topology.

> [!NOTE]
> This article describes the use of [transactional replication](https://docs.microsoft.com/sql/relational-databases/replication/transactional/transactional-replication) in Azure SQL Database. It is unrelated to [active geo-replication](https://docs.microsoft.com/azure/sql-database/sql-database-active-geo-replication), an Azure SQL Database feature that allows you to create complete readable replicas of individual databases.
## Supported Configurations

- Azure SQL Database can only be the push subscriber of a SQL Server publisher and distributor.
- The SQL Server acting as publisher and/or distributor can be an instance of [SQL Server running on-premises](https://www.microsoft.com/sql-server/sql-server-downloads), an [Azure SQL Managed Instance](../azure-sql/managed-instance/instance-create-quickstart.md), or an instance of [SQL Server running on an Azure virtual machine in the cloud](../virtual-machines/windows/sql-vm-create-portal-quickstart.md).
- The distribution database and the replication agents cannot be placed on an Azure SQL database.
- [Snapshot](/sql/relational-databases/replication/snapshot-replication) and [one-way transactional](/sql/relational-databases/replication/transactional/transactional-replication) replication are supported. Peer-to-peer transactional replication and merge replication are not supported.


### Versions

To successfully replicate to an Azure SQL Database, SQL Server publishers and distributors must be using (at least) one of the following versions:

Publishing to any Azure SQL Database from an on-premises SQL Server is supported by the following versions of SQL Server:

- SQL Server 2016 and greater
- SQL Server 2014 [RTM CU10 (12.0.4427.24)](https://support.microsoft.com/help/3094220/cumulative-update-10-for-sql-server-2014) or [SP1 CU3 (12.0.2556.4)](https://support.microsoft.com/help/3094221/cumulative-update-3-for-sql-server-2014-service-pack-1)
- SQL Server 2012 [SP2 CU8 (11.0.5634.1)](https://support.microsoft.com/help/3082561/cumulative-update-8-for-sql-server-2012-sp2) or [SP3 (11.0.6020.0)](https://www.microsoft.com/download/details.aspx?id=49996)

> [!NOTE]
> Attempting to configure replication using an unsupported version can result in error number MSSQL_REPL20084 (The process could not connect to Subscriber.) and MSSQL_REPL40532 (Cannot open server \<name> requested by the login. The login failed.).
To use all the features of Azure SQL Database, you must be using the latest versions of [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) and [SQL Server Data Tools](/sql/ssdt/download-sql-server-data-tools-ssdt).

### Types of replication

There are different [types of replication](https://docs.microsoft.com/sql/relational-databases/replication/types-of-replication):

| Replication | Azure SQL Database | Azure SQL Managed Instance |
| :----| :------------- | :--------------- |
| [**Standard Transactional**](https://docs.microsoft.com/sql/relational-databases/replication/transactional/transactional-replication) | Yes (only as subscriber) | Yes |
| [**Snapshot**](https://docs.microsoft.com/sql/relational-databases/replication/snapshot-replication) | Yes (only as subscriber) | Yes|
| [**Merge replication**](https://docs.microsoft.com/sql/relational-databases/replication/merge/merge-replication) | No | No|
| [**Peer-to-peer**](https://docs.microsoft.com/sql/relational-databases/replication/transactional/peer-to-peer-transactional-replication) | No | No|
| [**Bidirectional**](https://docs.microsoft.com/sql/relational-databases/replication/transactional/bidirectional-transactional-replication) | No | Yes|
| [**Updatable subscriptions**](https://docs.microsoft.com/sql/relational-databases/replication/transactional/updatable-subscriptions-for-transactional-replication) | No | No|
| &nbsp; | &nbsp; | &nbsp; |


## Remarks

- Only push subscriptions to Azure SQL Database are supported.
- Replication can be configured by using [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) or by executing Transact-SQL statements on the publisher. You cannot configure replication by using the Azure portal.
- Replication can only use SQL Server authentication logins to connect to Azure SQL Database.
- Replicated tables must have a primary key.
- You must have an existing Azure subscription.
- The Azure SQL Database subscriber can be in any region.
- A single publication on SQL Server can support both Azure SQL Database and SQL Server (on-premises and SQL Server in an Azure virtual machine) subscribers.
- Replication management, monitoring, and troubleshooting must be performed from SQL Server rather than Azure SQL Database.
- Only `@subscriber_type = 0` is supported in **sp_addsubscription** for SQL Database.
- Azure SQL Database does not support bi-directional, immediate, updatable, or peer-to-peer replication.

## Replication Architecture

![replication-to-sql-database](./media/replication-to-sql-database/replication-to-sql-database.png)

## Scenarios

### Typical Replication Scenario

1. Create a transactional replication publication on an on-premises SQL Server database.
2. On the on-premises SQL Server use the **New Subscription Wizard** or Transact-SQL statements to create a push to subscription to Azure SQL Database.
3. With single and pooled databases in Azure SQL Database, the initial data set is a snapshot that is created by the Snapshot Agent and distributed and applied by the Distribution Agent. With a SQL Managed Instance publisher, you can also use a database backup to seed the Azure SQL Database subscriber.

### Data Migration Scenario

1. Use transactional replication to replicate data from an on-premises SQL Server database to Azure SQL Database.
2. Redirect the client or middle-tier applications to update the Azure SQL database copy.
3. Stop updating the SQL Server version of the table and remove the publication.

## Limitations

The following options are not supported for Azure SQL Database subscriptions:

- Copy file groups association
- Copy table partitioning schemes
- Copy index partitioning schemes
- Copy user defined statistics
- Copy default bindings
- Copy rule bindings
- Copy fulltext indexes
- Copy XML XSD
- Copy XML indexes
- Copy permissions
- Copy spatial indexes
- Copy filtered indexes
- Copy data compression attribute
- Copy sparse column attribute
- Convert filestream to MAX data types
- Convert hierarchyid to MAX data types
- Convert spatial to MAX data types
- Copy extended properties
- Copy permissions

### Limitations to be determined

- Copy collation
- Execution in a serialized transaction of the SP

## Examples

Create a publication and a push subscription. For more information, see:

- [Create a Publication](https://docs.microsoft.com/sql/relational-databases/replication/publish/create-a-publication)
- [Create a Push Subscription](https://docs.microsoft.com/sql/relational-databases/replication/create-a-push-subscription/) by using the server name as the subscriber (for example **N'azuresqldbdns.database.windows.net'**) and the Azure SQL Database name as the destination database (for example **AdventureWorks**).

## See Also

- [Transactional replication](../managed-instance/replication-transactional-overview.md)
- [Create a Publication](https://docs.microsoft.com/sql/relational-databases/replication/publish/create-a-publication)
- [Create a Push Subscription](https://docs.microsoft.com/sql/relational-databases/replication/create-a-push-subscription/)
- [Types of Replication](https://docs.microsoft.com/sql/relational-databases/replication/types-of-replication)
- [Monitoring (Replication)](https://docs.microsoft.com/sql/relational-databases/replication/monitor/monitoring-replication)
- [Initialize a Subscription](https://docs.microsoft.com/sql/relational-databases/replication/initialize-a-subscription)
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Yes. You can use all existing migration technologies to migrate to Hyperscale, i

### What is my downtime during migration from an on-premises or virtual machine environment to Hyperscale, and how can I minimize it

Downtime for migration to Hyperscale is the same as the downtime when you migrate your databases to other Azure SQL Database service tiers. You can use [transactional replication](../../sql-database/replication-to-sql-database.md#data-migration-scenario
Downtime for migration to Hyperscale is the same as the downtime when you migrate your databases to other Azure SQL Database service tiers. You can use [transactional replication](replication-to-sql-database.md#data-migration-scenario
) to minimize downtime migration for databases up to few TB in size. For very large databases (10+ TB), you can consider to migrate data using ADF, Spark, or other data movement technologies.

### How much time would it take to bring in X amount of data to Hyperscale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ In this configuration, an Azure SQL Database or Azure SQL Managed Instance datab
## With failover groups

[Active geo-replication](active-geo-replication-overview.md) is not supported with a SQL Managed Instance using transactional replication. Instead of active geo-replication, use [Auto-failover groups](auto-failover-group-overview.md), but note that the publication has to be [manually deleted](transact-sql-tsql-differences-sql-server.md#replication) from the primary SQL Managed instance and recreated on the secondary SQL Managed Instance after failover.
[Active geo-replication](../database/active-geo-replication-overview.md) is not supported with a SQL Managed Instance using transactional replication. Instead of active geo-replication, use [Auto-failover groups](../database/auto-failover-group-overview.md), but note that the publication has to be [manually deleted](transact-sql-tsql-differences-sql-server.md#replication) from the primary SQL Managed instance and recreated on the secondary SQL Managed Instance after failover.

If geo-replication is enabled on a **publisher** or **distributor** SQL Managed Instance in a [failover group](auto-failover-group-overview.md), the SQL Managed Instance administrator must clean up all publications on the old primary and reconfigure them on the new primary after a failover occurs. The following activities are needed in this scenario:
If geo-replication is enabled on a **publisher** or **distributor** SQL Managed Instance in a [failover group](../database/auto-failover-group-overview.md), the SQL Managed Instance administrator must clean up all publications on the old primary and reconfigure them on the new primary after a failover occurs. The following activities are needed in this scenario:

1. Stop all replication jobs running on the database, if there are any.
1. Drop subscription metadata from publisher by running the following script on publisher database:
Expand Down Expand Up @@ -194,7 +194,7 @@ For more information about configuring transactional replication, see the follow
## See Also

- [Replication with an MI and a failover group](transact-sql-tsql-differences-sql-server.md#replication)
- [Replication to SQL Database](../../sql-database/replication-to-sql-database.md)
- [Replication to SQL Database](../database/replication-to-sql-database.md)
- [Replication to managed instance](../managed-instance/replication-between-two-instances-configure-tutorial.md)
- [Create a Publication](https://docs.microsoft.com/sql/relational-databases/replication/publish/create-a-publication)
- [Create a Push Subscription](https://docs.microsoft.com/sql/relational-databases/replication/create-a-push-subscription/)
Expand Down

0 comments on commit ee6f78f

Please sign in to comment.