You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/backup/tutorial-sql-backup.md
+63-63Lines changed: 63 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,10 @@
2
2
title: Tutorial - Back up SQL Server databases to Azure
3
3
description: In this tutorial, learn how to back up a SQL Server database running on an Azure VM to an Azure Backup Recovery Services vault.
4
4
ms.topic: tutorial
5
-
ms.date: 06/18/2019
5
+
ms.date: 01/07/2022
6
+
author: v-amallick
7
+
ms.service: backup
8
+
ms.author: v-amallick
6
9
---
7
10
# Back up a SQL Server database in an Azure VM
8
11
@@ -66,33 +69,27 @@ We do have aliasing for Azure table unsupported characters, but we recommend avo
66
69
67
70
Discover databases running on the VM.
68
71
69
-
1. In the [Azure portal](https://portal.azure.com), open the Recovery Services vault you use to back up the database.
72
+
1. In the [Azure portal](https://portal.azure.com), go to **Backup center** and click **+Backup**.
70
73
71
-
2. On the **Recovery Services vault** dashboard, select **Backup**.
74
+
1. Select **SQL in Azure VM** as the datasource type, select the Recovery Services vault you have created, and then click **Continue**.
72
75
73
-

76
+
:::image type="content" source="./media/backup-azure-sql-database/configure-sql-backup.png" alt-text="Screenshot showing to select Backup to view the databases running in a VM.":::
74
77
75
-
3. In **Backup Goal**, set **Where is your workload running** to **Azure** (the default).
76
-
77
-
4. In **What do you want to backup**, select **SQL Server in Azure VM**.
78
-
79
-

80
-
81
-
5. In **Backup Goal** > **Discover DBs in VMs**, select **Start Discovery** to search for unprotected VMs in the subscription. It can take a while, depending on the number of unprotected virtual machines in the subscription.
78
+
1. In **Backup Goal** > **Discover DBs in VMs**, select **Start Discovery** to search for unprotected VMs in the subscription. It can take a while, depending on the number of unprotected virtual machines in the subscription.
82
79
83
80
* Unprotected VMs should appear in the list after discovery, listed by name and resource group.
84
81
* If a VM isn't listed as you expect, check whether it's already backed up in a vault.
85
82
* Multiple VMs can have the same name but they'll belong to different resource groups.
86
83
87
84

88
85
89
-
6. In the VM list, select the VM running the SQL Server database > **Discover DBs**.
86
+
1. In the VM list, select the VM running the SQL Server database > **Discover DBs**.
90
87
91
-
7. Track database discovery in the **Notifications** area. It can take a while for the job to complete, depending on how many databases are on the VM. When the selected databases are discovered, a success message appears.
88
+
1. Track database discovery in the **Notifications** area. It can take a while for the job to complete, depending on how many databases are on the VM. When the selected databases are discovered, a success message appears.
2. Select **Configure Backup**, the **Select items to backup** pane appears. This lists all the registered availability groups and standalone SQL Servers. Expand the chevron to the left of the row to see all the unprotected databases in that instance or Always on AG.
111
+
1. Select **Add Resources**to see all the registered availability groups and standalone SQL Server instances.
115
112
116
-

3. Select all the databases you want to protect > **OK**.
115
+
1. In the **Select items to backup** screen, select the arrow to the left of a row to expand the list of all the unprotected databases in that instance or Always On availability group.
116
+
117
+

118
+
119
+
1. Choose all the databases you want to protect, and then select **OK**.
119
120
120
121

121
122
122
123
To optimize backup loads, Azure Backup sets a maximum number of databases in one backup job to 50.
123
124
124
-
* Alternatively, you can enable auto-protection on the entire instance or Always On Availability group by selecting the **ON** option in the corresponding dropdown in the **AUTOPROTECT** column. The auto-protection feature not only enables protection on all the existing databases in one go but also automatically protects any new databases that will be added to that instance or the availability group in future.
125
-
126
-
4. Select **OK** to open the **Backup policy** pane.
125
+
* To protect more than 50 databases, configure multiple backups.
126
+
* To [enable](/azure/backup/backup-sql-server-database-azure-vms#enable-auto-protection) the entire instance or the Always On availability group, in the **AUTOPROTECT** drop-down list, select **ON**, and then select **OK**.
127
127
128
-

128
+
> [!NOTE]
129
+
> The [auto-protection](/azure/backup/backup-sql-server-database-azure-vms#enable-auto-protection) feature not only enables protection on all the existing databases at once, but also automatically protects any new databases added to that instance or the availability group.
129
130
130
-
5. In **Choose backup policy**, select a policy, then select **OK**.
131
+
1. Define the **Backup policy**. You can do one of the following:
131
132
132
-
* Select the default policy: HourlyLogBackup.
133
+
* Select the default policy as *HourlyLogBackup*.
133
134
* Choose an existing backup policy previously created for SQL.
134
135
* Define a new policy based on your RPO and retention range.
1. Select**Enable Backup**to submit the **Configure Protection** operation and track the configuration progress in the **Notifications** area of the portal.
139
140
140
-

141
-
142
-
7. Track the configuration progress in the **Notifications** area of the portal.
@@ -151,59 +148,62 @@ A backup policy defines when backups are taken and how long they're retained.
151
148
* Multiple vaults can use the same backup policy, but you must apply the backup policy to each vault.
152
149
* When you create a backup policy, a daily full backup is the default.
153
150
* You can add a differential backup, but only if you configure full backups to occur weekly.
154
-
*[Learn about](backup-architecture.md#sql-server-backup-types) different types of backup policies.
151
+
* Learn about[different types of backup policies](backup-architecture.md#sql-server-backup-types).
155
152
156
153
To create a backup policy:
157
154
158
-
1. In the vault, select **Backup policies** > **Add**.
159
-
2. In **Add** menu, select **SQL Server in Azure VM** to define the policy type.
155
+
1. Go to **Backup center** and click **+Policy**.
156
+
157
+
1. Select **SQL Server in Azure VM** as the datasource type, select the vault under which the policy should be created, and then click **Continue**.
158
+
159
+
:::image type="content" source="./media/backup-azure-sql-database/create-sql-policy.png" alt-text="Screenshot showing to choose a policy type for the new backup policy.":::
160
+
161
+
1. In **Policy name**, enter a name for the new policy.
160
162
161
-

163
+
:::image type="content" source="./media/backup-azure-sql-database/sql-policy-summary.png" alt-text="Screenshot to showing to enter policy name.":::
162
164
163
-
3. In **Policy name**, enter a name for the new policy.
164
-
4. In **Full Backup policy**, select a **Backup Frequency**, choose **Daily** or **Weekly**.
165
+
1. Select the **Edit** link corresponding, to **Full backup**, to modify the default settings.
165
166
166
-
* For **Daily**, select the hour and time zone when the backup job begins.
167
-
* You must run a full backup as you can't turn off the **Full Backup** option.
168
-
* Select **Full Backup** to view the policy.
169
-
* You can't create differential backups for daily full backups.
170
-
* For **Weekly**, select the day of the week, hour, and time zone when the backup job begins.
167
+
* Select a **Backup Frequency**. Choose either **Daily** or **Weekly**.
168
+
* For **Daily**, select the hour and time zone when the backup job begins. You can't create differential backups for daily full backups.
:::image type="content" source="./media/backup-azure-sql-database/sql-backup-schedule-inline.png" alt-text="Screenshot showing new backup policy fields." lightbox="./media/backup-azure-sql-database/sql-backup-schedule-expanded.png":::
173
171
174
-
5. For**Retention Range**, by default all options are selected. Clear any undesired retention range limits you don't want to use, and set the intervals to use.
172
+
1. In**RETENTION RANGE**, all options are selected by default. Clear any retention range limits that you don't want, and then set the intervals to use.
175
173
176
-
* Minimum retention period for any type of backup (full/differential/log) is seven days.
174
+
* Minimum retention period for any type of backup (full, differential, and log) is seven days.
177
175
* Recovery points are tagged for retention based on their retention range. For example, if you select a daily full backup, only one full backup is triggered each day.
178
-
* The backup for a specific day is tagged and retained based on the weekly retention range and your weekly retention setting.
179
-
*The monthly and yearly retention ranges behave in a similar way.
176
+
* The backup for a specific day is tagged and retained based on the weekly retention range and the weekly retention setting.
177
+
*Monthly and yearly retention ranges behave in a similar way.
:::image type="content" source="./media/backup-azure-sql-database/sql-retention-range-inline.png" alt-text="Screenshot showing the retention range interval settings." lightbox="./media/backup-azure-sql-database/sql-retention-range-expanded.png":::
182
180
183
-
6. In the **Full Backup policy** menu, select **OK** to accept the settings.
184
-
7. To add a differential backup policy, select **Differential Backup**.
181
+
1. Select **OK** to accept the setting for full backups.
182
+
1. Select the **Edit** link corresponding to **Differential backup**, to modify the default settings.
185
183
186
-

187
-

184
+
* In **Differential Backup policy**, select **Enable** to open the frequency and retention controls.
185
+
* You can trigger only one differential backup per day. A differential backup can't be triggered on the same day as a full backup.
186
+
* Differential backups can be retained for a maximum of 180 days.
187
+
* The differential backup retention period can't be greater than that of the full backup (as the differential backups are dependent on the full backups for recovery).
188
+
* Differential Backup isn't supported for the master database.
188
189
189
-
8. In **Differential Backup policy**, select **Enable** to open the frequency and retention controls.
190
+
:::image type="content" source="./media/backup-azure-sql-database/sql-differential-backup-inline.png" alt-text="Screenshot showing the differential Backup policy." lightbox="./media/backup-azure-sql-database/sql-differential-backup-expanded.png":::
190
191
191
-
* At most, you can trigger one differential backup per day.
192
-
* Differential backups can be retained for a maximum of 180 days. If you need longer retention, you must use full backups.
192
+
1. Select the **Edit** link corresponding to **Log backup**, to modify the default settings
193
193
194
-
9. Select **OK** to save the policy and return to the main **Backup policy** menu.
194
+
* In **Log Backup**, select **Enable**, and then set the frequency and retention controls.
195
+
* Log backups can occur as often as every 15 minutes and can be retained for up to 35 days.
196
+
* If the database is in the [simple recovery model](/sql/relational-databases/backup-restore/recovery-models-sql-server), the log backup schedule for that database will be paused and so no log backups will be triggered.
197
+
* If the recovery model of the database changes from **Full** to **Simple**, log backups will be paused within 24 hours of the change in the recovery model. Similarly, if the recovery model changes from **Simple**, implying log backups can now be supported for the database, the log backups schedules will be enabled within 24 hours of the change in recovery model.
195
198
196
-
10. To add a transactional log backup policy, select **Log Backup**.
197
-
11. In **Log Backup**, select **Enable**, and then set the frequency and retention controls. Log backups can occur as often as every 15 minutes, and can be retained for up to 35 days.
198
-
12. Select **OK** to save the policy and return to the main **Backup policy** menu.
199
+
:::image type="content" source="./media/backup-azure-sql-database/sql-log-backup-inline.png" alt-text="Screenshot showing the log Backup policy." lightbox="./media/backup-azure-sql-database/sql-log-backup-expanded.png":::
199
200
200
-

201
+
1. On the **Backup policy** menu, choose whether to enable **SQL Backup Compression** or not. This option is disabled by default. If enabled, SQL Server will send a compressed backup stream to the VDI. Azure Backup overrides instance level defaults with COMPRESSION / NO_COMPRESSION clause depending on the value of this control.
201
202
202
-
13. On the **Backup policy** menu, choose whether to enable **SQL Backup Compression**.
203
-
* Compression is disabled by default.
204
-
* On the back end, Azure Backup uses SQL native backup compression.
203
+
1. After you complete the edits to the backup policy, select **OK**.
205
204
206
-
14. After you complete the edits to the backup policy, select **OK**.
205
+
> [!NOTE]
206
+
> Each log backup is chained to the previous full backup to form a recovery chain. This full backup will be retained until the retention of the last log backup has expired. This might mean that the full backup is retained for an extra period to make sure all the logs can be recovered. Let's assume you have a weekly full backup, daily differential and 2 hour logs. All of them are retained for 30 days. But, the weekly full can be really cleaned up/deleted only after the next full backup is available, that is, after 30 + 7 days. For example, a weekly full backup happens on Nov 16th. According to the retention policy, it should be retained until Dec 16th. The last log backup for this full happens before the next scheduled full, on Nov 22nd. Until this log is available until Dec 22nd, the Nov 16th full can't be deleted. So, the Nov 16th full is retained until Dec 22nd.
0 commit comments