Skip to content

Commit 19fbd1d

Browse files
SQL updates
1 parent fc429c4 commit 19fbd1d

6 files changed

+111
-22
lines changed

articles/backup/backup-azure-sql-restore-cli.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: Restore SQL server databases in Azure VMs using Azure Backup via CLI
33
description: Learn how to use CLI to restore SQL server databases in Azure VMs in the Recovery Services vault.
44
ms.topic: how-to
5-
ms.date: 08/11/2022
5+
ms.date: 07/18/2023
66
ms.service: backup
77
ms.custom: devx-track-azurecli
8-
author: jyothisuri
9-
ms.author: jsuri
8+
author: AbhishekMallick-MS
9+
ms.author: v-abhmallick
1010
---
1111

1212
# Restore SQL databases in an Azure VM using Azure CLI
@@ -364,6 +364,38 @@ The response provides you the job name. You can use this job name to track the j
364364
> [!NOTE]
365365
> If you don't want to restore the entire chain but only a subset of files, follow the steps as documented [here](restore-sql-database-azure-vm.md#partial-restore-as-files).
366366
367+
## Cross Subscription Restore
368+
369+
With Cross Subscription Restore (CSR), you have the flexibility of restoring to any subscription and any vault under your tenant if restore permissions are available. By default, CSR is enabled on all Recovery Services vaults (existing and newly created vaults).
370+
371+
>[!Note]
372+
>- You can trigger Cross Subscription Restore from Recovery Services vault.
373+
>- CSR is supported only for streaming based backup and is not supported for snapshot-based backup.
374+
>- Cross Regional Restore (CRR) with CSR is not supported.
375+
376+
377+
```azurecli
378+
az backup vault create
379+
380+
```
381+
382+
Add the parameter `cross-subscription-restore-state`` that enables you to set the CSR state of the vault during vault creation and updating.
383+
384+
```azurecli
385+
az backup recoveryconfig show
386+
387+
```
388+
389+
Add the parameter `--target-subscription-id`` that enables you to provide the target subscription as the input while triggering Cross Subscription Restore for SQL or HANA datasources.
390+
391+
**Example**:
392+
393+
```azurecli
394+
az backup vault create -g {rg_name} -n {vault_name} -l {location} --cross-subscription-restore-state Disable
395+
az backup recoveryconfig show --restore-mode alternateworkloadrestore --backup-management-type azureworkload -r {rp} --target-container-name {target_container} --target-item-name {target_item} --target-resource-group {target_rg} --target-server-name {target_server} --target-server-type SQLInstance --target-subscription-id {target_subscription} --target-vault-name {target_vault} --workload-type SQLDataBase --ids {source_item_id}
396+
397+
```
398+
367399
## Next steps
368400

369401
* Learn how to [manage SQL databases that are backed up using Azure CLI](backup-azure-sql-manage-cli.md).

articles/backup/restore-sql-database-azure-vm.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Azure Backup can restore SQL Server databases that are running on Azure VMs as f
2828
Before you restore a database, note the following:
2929

3030
- You can restore the database to an instance of a SQL Server in the same Azure region.
31-
- The destination server must be registered to the same vault as the source. If you want to restore backups to a different vault, enable **Cross Subscription Restore**.
31+
- The destination server must be registered to the same vault as the source. If you want to restore backups to a different vault, [enable Cross Subscription Restore](#cross-subscription-restore).
3232
- If you have multiple instances running on a server, all the instances should be up and running. Otherwise the server won't appear in the list of destination servers for you to restore the database to. For more information, refer to [the troubleshooting steps](backup-sql-server-azure-troubleshoot.md#faulty-instance-in-a-vm-with-multiple-sql-server-instances).
3333
- To restore a TDE-encrypted database to another SQL Server, you need to first [restore the certificate to the destination server](/sql/relational-databases/security/encryption/move-a-tde-protected-database-to-another-sql-server).
3434
- [CDC](/sql/relational-databases/track-changes/enable-and-disable-change-data-capture-sql-server) enabled databases should be restored using the [Restore as files](#restore-as-files) option.
@@ -203,7 +203,7 @@ To restore the database files to the *original path on the source server*, remov
203203
```
204204

205205
>[!Note]
206-
>You shouldn’t have the same database files on the target server (restore with replace).  Also, you can [enable instant file initialization on the target server to reduce the file initialization time overhead]( /sql/relational-databases/databases/database-instant-file-initialization?view=sql-server-ver16).
206+
>You shouldn’t have the same database files on the target server (restore with replace).  Also, you can [enable instant file initialization on the target server to reduce the file initialization time overhead]( /sql/relational-databases/databases/database-instant-file-initialization?view=sql-server-ver16&preserve-view=true).
207207
208208
To relocate the database files from the target restore server, you can frame a TSQL command using the `MOVE` clauses.
209209

@@ -220,7 +220,7 @@ To relocate the database files from the target restore server, you can frame a T
220220
GO
221221
```
222222

223-
If there are more than two files for the database, you can add additional `MOVE` clauses to the restore query. You can also use SSMS for database recovery using `.bak` files. [Learn more](/sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms?view=sql-server-ver16).
223+
If there are more than two files for the database, you can add additional `MOVE` clauses to the restore query. You can also use SSMS for database recovery using `.bak` files. [Learn more](/sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms?view=sql-server-ver16&preserve-view=true).
224224

225225
>[!Note]
226226
>For large database recovery, we recommend you to use TSQL statements. If you want to relocate the specific database files, see the list of database files in the JSON format created during the **Restore as Files** operation.
@@ -267,6 +267,32 @@ The secondary region restore user experience will be similar to the primary regi
267267

268268
:::image type="content" source="./media/backup-azure-sql-database/backup-center-jobs-inline.png" alt-text="Screenshot showing the filtered Backup jobs." lightbox="./media/backup-azure-sql-database/backup-center-jobs-expanded.png":::
269269

270+
271+
272+
## Cross Subscription Restore
273+
274+
Azure Backup now allows you to restore SQL database to any subscription (as per the following Azure RBAC requirements) from the restore point. By default, Azure Backup restores to the same subscription where the restore points are available.
275+
276+
With Cross Subscription Restore (CSR), you have the flexibility of restoring to any subscription and any vault under your tenant if restore permissions are available. By default, CSR is enabled on all Recovery Services vaults (existing and newly created vaults).
277+
278+
>[!Note]
279+
>- You can trigger Cross Subscription Restore from Recovery Services vault.
280+
>- CSR is supported only for streaming based backup and is not supported for snapshot-based backup.
281+
>- Cross Regional Restore (CRR) with CSR is not supported.
282+
283+
**Azure RBAC requirements**
284+
285+
| Operation type | Backup operator | Recovery Services vault | Alternate operator |
286+
| --- | --- | --- | --- |
287+
| Restore database or restore as files | `Virtual Machine Contributor` | Source VM that got backed up | Instead of a built-in role, you can consider a custom role which has the following permissions: <br><br> - `Microsoft.Compute/virtualMachines/write` <br> - `Microsoft.Compute/virtualMachines/read` |
288+
| | `Virtual Machine Contributor` | Target VM in which the database will be restored or files are created. | Instead of a built-in role, you can consider a custom role that has the following permissions: <br><br> - `Microsoft.Compute/virtualMachines/write` <br> - `Microsoft.Compute/virtualMachines/read` |
289+
| | Backup Operator | Target Recovery Services vault | |
290+
291+
By default, CSR is enabled on the Recovery Services vault. To update the Recovery Services vault restore settings, go to **Properties** > **Cross Subscription Restore** and make the required changes.
292+
293+
:::image type="content" source="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-database.png" alt-text="Screenshot shows how to modify the Cross Subscription Restore settings on a Recovery Services vault for SQL database." lightbox="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-database.png":::
294+
295+
270296
## Next steps
271297

272298
[Manage and monitor](manage-monitor-sql-database-backup.md) SQL Server databases that are backed up by Azure Backup.

articles/backup/sap-hana-database-restore.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ The secondary region restore user experience is similar to the primary region re
358358

359359
## Cross Subscription Restore
360360

361-
Azure Backup now allows you to restore SAP HANA Database to any subscription (using the Azure RBAC capabilities) from the restore point. By default, Azure Backup restores to the same subscription where the restore points are available.
361+
Azure Backup now allows you to restore SAP HANA Database to any subscription (as per the following Azure RBAC requirements) from the restore point. By default, Azure Backup restores to the same subscription where the restore points are available.
362362

363363
With Cross Subscription Restore (CSR), you have the flexibility of restoring to any subscription and any vault under your tenant if restore permissions are available. By default, CSR is enabled on all Recovery Services vaults (existing and newly created vaults).
364364

365365
>[!Note]
366366
>- You can trigger Cross Subscription Restore from Recovery Services vault.
367-
>- CSR is supported only for streaming/Backint-based backups and is not supported for snapshot-based backup.
368-
Cross Regional Restore (CRR) with CSR is not supported.
367+
>- CSR is supported only for streaming/Backint-based backups and is not supported for snapshot-based backup.
368+
>- Cross Regional Restore (CRR) with CSR is not supported.
369369

370370
**Azure RBAC requirements**
371371

@@ -377,9 +377,9 @@ Cross Regional Restore (CRR) with CSR is not supported.
377377

378378
By default, CSR is enabled on the Recovery Services vault. To update the Recovery Services vault restore settings, go to **Properties** > **Cross Subscription Restore** and make the required changes.
379379

380-
:::image type="content" source="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-hana.png" alt-text="Screenshot shows how to modify the Cross Subscription Restore settings on a Recovery Services vault for HANA database." lightbox="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-hana.png":::
380+
:::image type="content" source="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-database.png" alt-text="Screenshot shows how to modify the Cross Subscription Restore settings on a Recovery Services vault for HANA database." lightbox="./media/sap-hana-db-restore/cross-subscription-restore-settings-for-database.png":::
381381

382-
**Related CLI command**
382+
**Cross Subscription Restore using Azure CLI**
383383

384384
```azurecli
385385
az backup vault create

articles/backup/tutorial-sap-hana-backup-cli.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.author: jsuri
1111

1212
# Tutorial: Back up SAP HANA databases in an Azure VM using Azure CLI
1313

14-
This tutorial describes how to back up SAP HANA database instance and SAP HANA System Replication (HSR) instance (preview) using Azure CLI.
14+
This tutorial describes how to back up SAP HANA database instance and SAP HANA System Replication (HSR) instance using Azure CLI.
1515

1616
Azure CLI is used to create and manage Azure resources from the Command Line or through scripts. This documentation details how to back up an SAP HANA database and trigger on-demand backups - all using Azure CLI. You can also perform these steps using the [Azure portal](./backup-azure-sap-hana-database.md).
1717

@@ -64,7 +64,7 @@ Location Name ResourceGroup
6464
westus2 saphanaVault saphanaResourceGroup
6565
```
6666

67-
# [HSR (preview)](#tab/hsr)
67+
# [HSR](#tab/hsr)
6868

6969
To create the Recovery Services vault for HSR instance protection, run the following command:
7070

@@ -113,7 +113,7 @@ To register and protect database instance, follow these steps:
113113
> The column “name” in the above output refers to the container name. This container name will be used in the next sections to enable backups and trigger them. Which in this case, is *VMAppContainer;Compute;saphanaResourceGroup;saphanaVM*.
114114
115115
116-
# [HSR (preview)](#tab/hsr)
116+
# [HSR](#tab/hsr)
117117
118118
To register and protect database instance, follow these steps:
119119
@@ -217,7 +217,7 @@ To get container name, run the following command. [Learn about this CLI command]
217217
218218
```
219219

220-
# [HSR (preview)](#tab/hsr)
220+
# [HSR](#tab/hsr)
221221

222222
To enable database instance backup, follow these steps:
223223

@@ -292,7 +292,7 @@ The response will give you the job name. This job name can be used to track the
292292
>[!NOTE]
293293
>Log backups are automatically triggered and managed by SAP HANA internally.
294294
295-
# [HSR (preview)](#tab/hsr)
295+
# [HSR](#tab/hsr)
296296

297297
To run an on-demand backup, run the following command:
298298

articles/backup/tutorial-sap-hana-restore-cli.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
title: Tutorial - SAP HANA DB restore on Azure using CLI
33
description: In this tutorial, learn how to restore SAP HANA databases running on an Azure VM from an Azure Backup Recovery Services vault using Azure CLI.
44
ms.topic: tutorial
5-
ms.date: 06/20/2023
5+
ms.date: 07/18/2023
66
ms.custom: devx-track-azurecli
77
ms.service: backup
8-
author: jyothisuri
9-
ms.author: jsuri
8+
author: AbhishekMallick-MS
9+
ms.author: v-abhmallick
1010
---
1111

1212
# Tutorial: Restore SAP HANA databases in an Azure VM using Azure CLI
1313

14-
This tutorial describes how to restore SAP HANA database instance and SAP HANA System Replication (HSR) instance (preview) using Azure CLI.
14+
This tutorial describes how to restore SAP HANA database instance and SAP HANA System Replication (HSR) instance using Azure CLI.
1515

1616
Azure CLI is used to create and manage Azure resources from the command line or through scripts. This documentation details how to restore a backed-up SAP HANA database on an Azure VM - using Azure CLI. You can also perform these steps using the [Azure portal](./sap-hana-db-restore.md).
1717

@@ -61,7 +61,7 @@ DefaultRangeRecoveryPoint AzureWorkload
6161

6262
As you can see, the list above contains three recovery points: one each for full, differential, and log backup.
6363

64-
# [HSR (preview)](#tab/hsr)
64+
# [HSR](#tab/hsr)
6565

6666
To view the available recovery points, run the following command:
6767

@@ -167,7 +167,7 @@ Name Resource
167167

168168
The response will give you the job name. This job name can be used to track the job status using [az backup job show](/cli/azure/backup/job#az-backup-job-show) cmdlet.
169169

170-
# [HSR (preview)](#tab/hsr)
170+
# [HSR](#tab/hsr)
171171

172172
To start the restore operation, run the following command:
173173

@@ -502,6 +502,37 @@ Move these restored files to the SAP HANA server where you want to restore them
502502
* `<LogFilesDir>` - the folder that contains the log backups, differential and incremental backups (if any)
503503
* `<BackupIdFromJsonFile>` - the **BackupId** extracted in **Step 3**
504504
505+
## Cross Subscription Restore
506+
507+
With Cross Subscription Restore (CSR), you have the flexibility of restoring to any subscription and any vault under your tenant if restore permissions are available. By default, CSR is enabled on all Recovery Services vaults (existing and newly created vaults).
508+
509+
>[!Note]
510+
>- You can trigger Cross Subscription Restore from Recovery Services vault.
511+
>- CSR is supported only for streaming/Backint-based backups and is not supported for snapshot-based backup.
512+
>- Cross Regional Restore (CRR) with CSR is not supported.
513+
514+
```azurecli
515+
az backup vault create
516+
517+
```
518+
519+
Add the parameter `cross-subscription-restore-state`` that enables you to set the CSR state of the vault during vault creation and updating.
520+
521+
```azurecli
522+
az backup recoveryconfig show
523+
524+
```
525+
526+
Add the parameter `--target-subscription-id`` that enables you to provide the target subscription as the input while triggering Cross Subscription Restore for SQL or HANA datasources.
527+
528+
**Example**:
529+
530+
```azurecli
531+
az backup vault create -g {rg_name} -n {vault_name} -l {location} --cross-subscription-restore-state Disable
532+
az backup recoveryconfig show --restore-mode alternateworkloadrestore --backup-management-type azureworkload -r {rp} --target-container-name {target_container} --target-item-name {target_item} --target-resource-group {target_rg} --target-server-name {target_server} --target-server-type SQLInstance --target-subscription-id {target_subscription} --target-vault-name {target_vault} --workload-type SQLDataBase --ids {source_item_id}
533+
534+
```
535+
505536
## Next steps
506537
507538
* To learn how to manage SAP HANA databases that are backed up using Azure CLI, continue to the tutorial [Manage an SAP HANA database in Azure VM using CLI](tutorial-sap-hana-backup-cli.md)

0 commit comments

Comments
 (0)