Skip to content

Commit 3c4e2b8

Browse files
authored
Merge pull request #48723 from WilliamDAssafMSFT/20250113-backup-azure-sql-db
20250115 refresh
2 parents 004dfa5 + 840996d commit 3c4e2b8

12 files changed

+32
-27
lines changed

learn-pr/azure/azure-sql-secure-data/includes/3-exercise-configure-sql-database.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ These scripts should take three to five minutes to complete. Be sure to note you
1212
(Invoke-WebRequest -Uri "https://ipinfo.io/ip").Content
1313
```
1414
15-
1. Run the following commands in Cloud Shell. Enter a complex password and, at the prompt, enter your local public IP address, which you obtained in the preceding step. Replace "[sandbox resource group name]" with "<rgn>[sandbox resource group name]</rgn>".
15+
1. Run the following commands in Cloud Shell. Enter a complex password and, at the prompt, enter your local public IP address, which you obtained in the preceding step.
1616
1717
```powershell
1818
$adminSqlLogin = "cloudadmin"
1919
$password = Read-Host "Your username is 'cloudadmin'. Enter a password for your Azure SQL Database server that meets the password requirements"
2020
# Prompt for local ip address
2121
$ipAddress = Read-Host "Disconnect your VPN, open PowerShell on your machine and run '(Invoke-WebRequest -Uri "https://ipinfo.io/ip").Content'. Enter the value (include periods) next to 'Address' "
2222
# Get resource group and location and random string
23-
$resourceGroup = Get-AzResourceGroup | Where ResourceGroupName -like "[sandbox resource group name]"
24-
$resourceGroupName = "[sandbox resource group name]"
23+
$resourceGroup = Get-AzResourceGroup | Where ResourceGroupName -like "<rgn>[sandbox resource group name]</rgn>"
24+
$resourceGroupName = $resourceGroup.ResourceGroupName
2525
$uniqueID = Get-Random -Minimum 100000 -Maximum 1000000
2626
$storageAccountName = "mslearnsa"+$uniqueID
2727
$location = $resourceGroup.Location

learn-pr/azure/backup-restore-azure-sql/3-exercise-configure-backup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
prefetch-feature-rollout: true
66
title: Exercise - Configure backups for Azure SQL Database
77
description: Learn how to set up an Azure SQL database and configure automated backups for it.
8-
ms.date: 12/11/2023
8+
ms.date: 01/15/2025
99
author: WilliamDAssafMSFT
1010
ms.author: wiassaf
1111
manager: jroth

learn-pr/azure/backup-restore-azure-sql/includes/6-restore-database.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ In the portal, go to the database server's **Overview** page. Then, in the **Ope
4242

4343
Azure SQL Database automatically replicates backed-up databases to datacenters in other regions. If the database in the original region is unavailable—for example, because of a datacenter outage—you can restore from one of these replicated backup copies. You can restore up to the point in time when Azure SQL Database made the backup. The latest backup might not have fully replicated to your region, so you might lose some recent changes.
4444

45-
To perform a geo-restore in the Azure portal, add a new database to an Azure SQL Database server, then select **Backup** in the **Select source** drop-down list and choose the backup from which to restore.
45+
To perform a geo-restore in the Azure portal, add a new database to an Azure SQL Database server, then select **Backup** in the **Select source** dropdown list and choose the backup from which to restore.
Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
Trial restores are a key component of any disaster recovery strategy.
22

3-
You want to familiarize yourself with the steps to restore a backed-up database to a specific point in time, in case it becomes necessary. You also want to investigate how long a restore operation takes. That way, you can plan for this time in your guidance for your organization.
3+
You want to familiarize yourself with the steps to restore a backed-up database to a specific point in time, in case it becomes necessary. You also want to investigate how long a restore operation takes, a key part of the calculation of Recovery Time Objection (RTO). You can plan for this time in your guidance for your organization.
4+
5+
You can treat the restored database as a replacement for the original database or use it as a data source to update the original database. Though you can overwrite and replace a database in a SQL Server instance or Azure SQL Managed Instance, you cannot overwrite an Azure SQL Database with a restore.
46

57
Let's perform a restore from automated Azure SQL Database backups.
68

79
## Confirm that backups are active
810

9-
It can take up to 15 minutes for the first successful backup to finish. We need to make sure that backups are running before we continue the exercise.
11+
> [!TIP]
12+
> It can take up to 15 minutes after database creation for the first successful backup to finish.
13+
14+
Let's look at the backups Azure SQL takes for us, automatically.
1015

1116
1. In Azure Cloud Shell, run the following PowerShell command to set a variable to the value of your SQL Server instance:
1217

1318
```powershell
1419
$sqlserver=Get-AzSqlServer
1520
```
1621
17-
1. Validate that continuous backups are running by using this command:
22+
1. View the available restore points, based on backups, with the `Get-AzSqlDatabaseRestorePoint` PowerShell cmdlet:
1823
1924
```powershell
2025
Get-AzSqlDatabaseRestorePoint `
@@ -23,7 +28,7 @@ It can take up to 15 minutes for the first successful backup to finish. We need
2328
-ServerName $sqlserver.ServerName
2429
```
2530
26-
You should get an output similar to the following code if your backups are running. If the command returns no value, a backup hasn't started yet. Rerun this command in a couple of minutes.
31+
You should get an output similar to the following code. If the command returns no value, a backup hasn't started yet. Rerun this command in a couple of minutes.
2732
2833
```output
2934
ResourceGroupName : <rgn>[sandbox resource group name]</rgn>
@@ -42,11 +47,11 @@ It can take up to 15 minutes for the first successful backup to finish. We need
4247
4348
Let's start by simulating a mistaken database modification.
4449
45-
1. On the [Azure portal](https://portal.azure.com/learn.docs.microsoft.com?azure-portal=true) menu or from the **Home** page, select **All resources**, select **erpserver-NNNN**, select **SQL databases**, and then select the **sql-erp-db** database.
50+
1. On the [Azure portal](https://portal.azure.com/learn.docs.microsoft.com?azure-portal=true) menu or from the **Home** page, select **All resources**, select **erpserver-NNNN**, select **SQL databases**, and then select the **sql-erp-db** database.
4651
47-
1. Select **Query editor (preview)**, then sign in with the **dbadmin** user and the password that you specified for this account.
52+
1. We'll use the T-SQL query editor built into the Azure portal. Select **Query editor (preview)**, then sign in with the **dbadmin** user and the password that you specified for this account. The following T-SQL commands would also work in SQL Server Management Studio, or the mssql extension for Visual Studio Code, or other T-SQL query tools.
4853
49-
1. Let's drop the **Person** table that we created earlier. In a new query window, run this command.
54+
1. Let's drop the `Person` table that we created earlier. In a new query window, run this command. Note the time on your clock.
5055
5156
```sql
5257
DROP TABLE Person
@@ -57,43 +62,43 @@ Let's start by simulating a mistaken database modification.
5762
```sql
5863
SELECT schema_name(t.schema_id) as schema_name,
5964
t.name as table_name
60-
FROM sys.tables t
65+
FROM sys.tables AS t
6166
ORDER BY schema_name, table_name;
6267
```
6368
64-
You should see **No results** returned, because we deleted the **Person** table.
69+
You should see **No results** returned, because we deleted the `Person` table.
6570
6671
:::image type="content" source="../media/7-no-results.png" alt-text="Screenshot that shows no results returned after querying for the tables in the database.":::
6772
68-
## Run a point-in-time restore
73+
## Create a point-in-time restore
6974
70-
The **Person** table was mistakenly deleted. Now, let's restore the database to its previous state.
75+
The `Person` table was mistakenly deleted. Now, let's restore the database to its previous state.
7176
7277
1. On the [Azure portal](https://portal.azure.com/learn.docs.microsoft.com?azure-portal=true) menu or from the **Home** page, select **All resources**, and then select the **sql-erp-db** database.
7378
7479
1. At the top of the **Overview** page, select **Restore**.
7580
76-
1. Complete the **Basics** tab on the **Restore database** page with these values, and then select **Review + create**.
81+
1. Complete the **Basics** tab on the **Restore database** page with these values, and then select **Review + create**. Here, you provide a new database name for the restored version of the database.
7782
7883
| Setting | Value |
7984
| --- | --- |
8085
| Select source | **Point-in-time** |
81-
| Database name | sql-erp-db-xxxxx |
82-
| Restore point | Select a time 10 minutes ago, before you dropped the **Person** table |
86+
| Database name | `sql-erp-db-restored` |
87+
| Restore point | Select a time before you dropped the `Person` table, perhaps 10 minutes ago. |
8388
| Server | erpserver-xxxxx |
8489
| Want to use SQL elastic pool? | No |
8590
| Compute + storage | Default value |
8691
| Backup storage redundancy | **Locally-redundant backup storage** |
8792
88-
:::image type="content" source="../media/7-restore-sql-database-pitr.png" alt-text="Screenshot that shows the restore database page with the Review + create button selected." lightbox="../media/7-restore-sql-database-pitr.png":::
93+
:::image type="content" source="../media/7-restore-sql-database-point-in-time-recovery.png" alt-text="Screenshot that shows the restore database page with the Review + create button selected." lightbox="../media/7-restore-sql-database-point-in-time-recovery.png":::
8994
9095
1. Select **Create**. The database restore takes several minutes to complete.
9196
9297
## View the restored database
9398
94-
The restored database should contain the **Person** table. You can check that in the portal.
99+
The restored database contains the `Person` table.
95100
96-
1. In the [Azure portal](https://portal.azure.com/learn.docs.microsoft.com?azure-portal=true) menu or from the **Home** page, select **All resources**, and then select the **sql-erp-db-restored** database.
101+
1. In the [Azure portal](https://portal.azure.com/learn.docs.microsoft.com?azure-portal=true) menu or from the **Home** page, select **All resources**, and then select the `sql-erp-db-restored` database.
97102
98103
1. Select **Query editor (preview)**, and then sign in with the **dbadmin** user and the password that you specified for this account.
99104
@@ -102,22 +107,22 @@ The restored database should contain the **Person** table. You can check that in
102107
```sql
103108
SELECT schema_name(t.schema_id) as schema_name,
104109
t.name as table_name
105-
FROM sys.tables t
110+
FROM sys.tables AS t
106111
ORDER BY schema_name, table_name;
107112
```
108113
109-
The **Person** table should now be present.
114+
The database has been restore to the state it was, including the `Person` table.
110115
111-
:::image type="content" source="../media/7-query-after-restore-1.png" alt-text="Screenshot showing results after querying for the tables in the database.":::
116+
:::image type="content" source="../media/7-query-after-restore-person-table.png" alt-text="Screenshot showing results after querying for the tables in the database.":::
112117
113118
1. Confirm that the data is in the table by running this command:
114119
115120
```sql
116-
SELECT * FROM Person
121+
SELECT * FROM Person;
117122
```
118123
119124
You should see the data that you entered previously.
120125
121-
:::image type="content" source="../media/7-query-after-restore-2.png" alt-text="Screenshot showing confirmed results after querying for the tables in the database.":::
126+
:::image type="content" source="../media/7-query-after-restore-select.png" alt-text="Screenshot showing confirmed results after querying for the tables in the database.":::
122127
123128
You've now learned how you can restore a database if something unintended happens to the data. You've familiarized yourself with the restore process. You can now assure your organization that you've properly defined the backup and restore procedures.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)