Skip to content

Commit ad697d7

Browse files
authored
Merge pull request #191330 from MashaMSFT/2022_linkfix1
Editing best practices article
2 parents cc88883 + 8366b85 commit ad697d7

File tree

6 files changed

+88
-5
lines changed

6 files changed

+88
-5
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: The link feature best practices
3+
titleSuffix: Azure SQL Managed Instance
4+
description: Learn about best practices when using the link feature for Azure SQL Managed Instance.
5+
services: sql-database
6+
ms.service: sql-managed-instance
7+
ms.subservice: data-movement
8+
ms.custom:
9+
ms.devlang:
10+
ms.topic: guide
11+
author: MladjoA
12+
ms.author: mlandzic
13+
ms.reviewer: mathoma, danil
14+
ms.date: 03/10/2022
15+
---
16+
# Best practices with link feature for Azure SQL Managed Instance (preview)
17+
[!INCLUDE[appliesto-sqlmi](../includes/appliesto-sqlmi.md)]
18+
19+
This article outlines best practices when using the link feature for Azure SQL Managed Instance. The link feature for Azure SQL Managed Instance connects your SQL Servers hosted anywhere to SQL Managed Instance, providing near real-time data replication to the cloud.
20+
21+
> [!NOTE]
22+
> The link feature for Azure SQL Managed Instance is currently in preview.
23+
24+
## Take log backups regularly
25+
26+
The link feature replicates data using the [Distributed availability groups](/sql/database-engine/availability-groups/windows/distributed-availability-groups) concept based the Always On availability groups technology stack. Data replication with distributed availability groups is based on replicating transaction log records. No transaction log records can be truncated from the database on the primary instance until they're replicated to the database on the secondary instance. If transaction log record replication is slow or blocked due to network connection issues, the log file keeps growing on the primary instance. Growth speed depends on the intensity of workload and the network speed. If there's a prolonged network connection outage and heavy workload on primary instance, the log file may take all available storage space.
27+
28+
29+
To minimize the risk of running out of space on your primary instance due to log file growth, make sure to take database log backups regularly. By taking log backups regularly, you make your database more resilient to unplanned log growth events. Consider scheduling daily log backup tasks using SQL Server Agent job.
30+
31+
You can use a Transact-SQL (T-SQL) script to back up the log file, such as the sample provided in this section. Replace the placeholders in the sample script with name of your database, name and path of the backup file, and the description.
32+
33+
To back up your transaction log, use the following sample Transact-SQL (T-SQL) script:
34+
35+
```sql
36+
37+
USE [<DatabaseName>]
38+
--Set current database inside job step or script
39+
--Check that you are executing the script on the primary instance
40+
if (SELECT role
41+
FROM sys.dm_hadr_availability_replica_states AS a
42+
JOIN sys.availability_replicas AS b
43+
ON b.replica_id = a.replica_id
44+
WHERE b.replica_server_name = @@SERVERNAME) = 1
45+
BEGIN
46+
-- Take log backup
47+
BACKUP LOG [<DatabaseName>]
48+
TO DISK = N'<DiskPathandFileName>'
49+
WITH NOFORMAT, NOINIT,
50+
NAME = N'<Description>', SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 1
51+
END
52+
```
53+
54+
55+
Use the following Transact-SQL (T-SQL) command to check the log spaced used by your database:
56+
57+
```sql
58+
DBCC SQLPERF(LOGSPACE);
59+
```
60+
61+
The query output looks like the following example below for sample database **tpcc**:
62+
63+
:::image type="content" source="./media/link-feature-best-practices/database-log-file-size.png" alt-text="Screenshot with results of the command showing log file size and space used":::
64+
65+
In this example, the database has used 76% of the available log, with an absolute log file size of approximately 27 GB (27,971 MB). The thresholds for action may vary based on your workload, but it's typically an indication that you should take a log backup to truncate log file and free up some space.
66+
67+
## Add startup trace flags
68+
69+
There are two trace flags (`-T1800` and `-T9567`) that, when added as start up parameters, can optimize the performance of data replication through the link. See [Enable startup trace flags](managed-instance-link-preparation.md#enable-startup-trace-flags) to learn more.
70+
71+
## Next steps
72+
73+
To get started with the link feature, [prepare your environment for replication](managed-instance-link-preparation.md).
74+
75+
For more information on the link feature, see the following articles:
76+
77+
- [Managed Instance link – overview](link-feature.md)
78+
- [Managed Instance link – connecting SQL Server to Azure reimagined](https://aka.ms/mi-link-techblog)

articles/azure-sql/managed-instance/managed-instance-link-preparation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ ms.date: 03/07/2022
1919

2020
This article teaches you to prepare your environment for the [Managed Instance link feature](link-feature.md) so that you can replicate your databases from your instance of SQL Server to your instance of Azure SQL Managed Instance.
2121

22-
Managed Instance link is currently in public preview.
22+
> [!NOTE]
23+
> The link feature for Azure SQL Managed Instance is currently in preview.
2324
2425
## Prerequisites
2526

@@ -82,7 +83,7 @@ If the availability groups feature is not enabled, follow these steps to enable
8283

8384
1. Select **OK** on the dialog box to restart the SQL Server service.
8485

85-
### Enable feature startup trace flags
86+
### Enable startup trace flags
8687

8788
To optimize Managed Instance link performance, enabling trace flags `-T1800` and `-T9567` at startup is highly recommended:
8889

articles/azure-sql/managed-instance/managed-instance-link-use-ssms-to-failover-database.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Failing over your database from your SQL Server instance to your SQL Managed Ins
2323

2424
Before failing over your database, make sure you've [prepared your environment](managed-instance-link-preparation.md) and [configured replication through the link feature](managed-instance-link-use-ssms-to-replicate-database.md).
2525

26-
Managed Instance link is currently in public preview.
26+
> [!NOTE]
27+
> The link feature for Azure SQL Managed Instance is currently in preview.
2728
2829
## Prerequisites
2930

articles/azure-sql/managed-instance/managed-instance-link-use-ssms-to-replicate-database.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ This article teaches you to use the [Managed Instance link feature](link-feature
2121

2222
Before configuring replication for your database through the link feature, make sure you've [prepared your environment](managed-instance-link-preparation.md).
2323

24-
Managed Instance link is currently in public preview.
24+
> [!NOTE]
25+
> The link feature for Azure SQL Managed Instance is currently in preview.
2526
2627
## Prerequisites
2728

37.3 KB
Loading

articles/azure-sql/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,14 +1229,16 @@
12291229
- name: Migrate TDE cert
12301230
href: managed-instance/tde-certificate-migrate.md
12311231

1232-
- name: Managed Instance link
1232+
- name: Managed Instance link feature
12331233
items:
12341234
- name: Prepare environment for link
12351235
href: managed-instance/managed-instance-link-preparation.md
12361236
- name: Replicate databases in SSMS
12371237
href: managed-instance/managed-instance-link-use-ssms-to-replicate-database.md
12381238
- name: Failover databases in SSMS
12391239
href: managed-instance/managed-instance-link-use-ssms-to-failover-database.md
1240+
- name: Best practices
1241+
href: managed-instance/link-feature-best-practices.md
12401242

12411243
- name: Configure business continuity
12421244
items:

0 commit comments

Comments
 (0)