|
2 | 2 | title: SQL DB in Azure VM backup & restore via PowerShell
|
3 | 3 | description: Back up and restore SQL Databases in Azure VMs using Azure Backup and PowerShell.
|
4 | 4 | ms.topic: conceptual
|
5 |
| -ms.date: 07/15/2022 |
| 5 | +ms.date: 01/21/2024 |
6 | 6 | ms.assetid: 57854626-91f9-4677-b6a2-5d12b6a866e1
|
7 | 7 | ms.custom: devx-track-azurepowershell
|
8 | 8 | ms.service: backup
|
@@ -102,7 +102,7 @@ The Recovery Services vault is a Resource Manager resource, so you must place it
|
102 | 102 | 3. Specify the type of redundancy to use for the vault storage.
|
103 | 103 |
|
104 | 104 | * You can use [locally redundant storage](../storage/common/storage-redundancy.md#locally-redundant-storage), [geo-redundant storage](../storage/common/storage-redundancy.md#geo-redundant-storage) or [zone-redundant storage](../storage/common/storage-redundancy.md#zone-redundant-storage) .
|
105 |
| - * The following example sets the **-BackupStorageRedundancy** option for the [Set-AzRecoveryServicesBackupProperty](/powershell/module/az.recoveryservices/set-azrecoveryservicesbackupproperty) cmd for **testvault** set to **GeoRedundant**. |
| 105 | + * The following example sets the `-BackupStorageRedundancy` option for the [Set-AzRecoveryServicesBackupProperty](/powershell/module/az.recoveryservices/set-azrecoveryservicesbackupproperty) cmd for `testvault` set to `GeoRedundant`. |
106 | 106 |
|
107 | 107 | ```powershell
|
108 | 108 | $vault1 = Get-AzRecoveryServicesVault -Name "testvault"
|
@@ -136,7 +136,7 @@ Store the vault object in a variable, and set the vault context.
|
136 | 136 | * Many Azure Backup cmdlets require the Recovery Services vault object as an input, so it's convenient to store the vault object in a variable.
|
137 | 137 | * The vault context is the type of data protected in the vault. Set it with [Set-AzRecoveryServicesVaultContext](/powershell/module/az.recoveryservices/set-azrecoveryservicesvaultcontext). After the context is set, it applies to all subsequent cmdlets.
|
138 | 138 |
|
139 |
| -The following example sets the vault context for **testvault**. |
| 139 | +The following example sets the vault context for `testvault` |
140 | 140 |
|
141 | 141 | ```powershell
|
142 | 142 | Get-AzRecoveryServicesVault -Name "testvault" | Set-AzRecoveryServicesVaultContext
|
@@ -226,7 +226,7 @@ Now that we have the required SQL DB and the policy with which it needs to be ba
|
226 | 226 | Enable-AzRecoveryServicesBackupProtection -ProtectableItem $SQLDB -Policy $NewSQLPolicy
|
227 | 227 | ```
|
228 | 228 |
|
229 |
| -The command waits until the configure backup is completed and returns the following output. |
| 229 | +The command waits until the backup configuration is completed and returns the following output. |
230 | 230 |
|
231 | 231 | ```output
|
232 | 232 | WorkloadName Operation Status StartTime EndTime JobID
|
@@ -330,7 +330,7 @@ The above output means that you can restore to any point-in-time between the dis
|
330 | 330 |
|
331 | 331 | ### Determine recovery configuration
|
332 | 332 |
|
333 |
| -In the case of a SQL DB restore, the following restore scenarios are supported. |
| 333 | +For a SQL DB restore, the following restore scenarios are supported. |
334 | 334 |
|
335 | 335 | * Overriding the backed-up SQL DB with data from another recovery point - OriginalWorkloadRestore
|
336 | 336 | * Restoring the SQL DB as a new DB in the same SQL instance - AlternateWorkloadRestore
|
@@ -539,7 +539,7 @@ $PairedRegionVault = Get-AzRecoveryServicesVault -ResourceGroupName SecondaryRG
|
539 | 539 | $secContainer = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVMAppContainer -Status Registered -VaultId $PairedRegionVault.ID -FriendlyName "secondaryVM"
|
540 | 540 | ```
|
541 | 541 |
|
542 |
| -Once the registered container is chosen, then we fetch the SQL instances within the container to which the DB should be restored to. Here we assume that there is 1 SQL instance within the "secondaryVM" and we fetch that instance. |
| 542 | +Once the registered container is chosen, then we fetch the SQL instances within the container to which the database should be restored. Here we assume that there's 1 SQL instance within the "secondaryVM" and we fetch that instance. |
543 | 543 |
|
544 | 544 | ```powershell
|
545 | 545 | $secSQLInstance = Get-AzRecoveryServicesBackupProtectableItem -WorkloadType MSSQL -ItemType SQLInstance -VaultId $PairedRegionVault.ID -Container $secContainer
|
@@ -606,15 +606,15 @@ If the output is lost or if you want to get the relevant Job ID, [get the list o
|
606 | 606 |
|
607 | 607 | ### Change policy for backup items
|
608 | 608 |
|
609 |
| -You can change the policy of the backed-up item from *Policy1* to *Policy2*. To switch policies for a backed-up item, fetch the relevant policy and back up item and use the [Enable-AzRecoveryServices](/powershell/module/az.recoveryservices/enable-azrecoveryservicesbackupprotection) command with backup item as the parameter. |
| 609 | +You can change the policy of the backed-up item from `Policy1` to `Policy2`. To switch policies for a backed-up item, fetch the relevant policy and back up item and use the [Enable-AzRecoveryServices](/powershell/module/az.recoveryservices/enable-azrecoveryservicesbackupprotection) command with backup item as the parameter. |
610 | 610 |
|
611 | 611 | ```powershell
|
612 | 612 | $TargetPol1 = Get-AzRecoveryServicesBackupProtectionPolicy -Name <PolicyName>
|
613 | 613 | $anotherBkpItem = Get-AzRecoveryServicesBackupItem -WorkloadType MSSQL -BackupManagementType AzureWorkload -Name "<BackupItemName>"
|
614 | 614 | Enable-AzRecoveryServicesBackupProtection -Item $anotherBkpItem -Policy $TargetPol1
|
615 | 615 | ```
|
616 | 616 |
|
617 |
| -The command waits until the configure backup is completed and returns the following output. |
| 617 | +The command waits until the backup configuration is completed and returns the following output. |
618 | 618 |
|
619 | 619 | ```output
|
620 | 620 | WorkloadName Operation Status StartTime EndTime JobID
|
|
0 commit comments