Skip to content

Commit 6cd8505

Browse files
Merge pull request #105703 from MashaMSFT/20200226_mipitr
added portal pitr (AzB 1670735)
2 parents a1622be + 7df293c commit 6cd8505

File tree

2 files changed

+44
-36
lines changed

2 files changed

+44
-36
lines changed

articles/sql-database/sql-database-managed-instance-point-in-time-restore.md

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Managed instance - Point-in-time restore
2+
title: Managed instance - Point-in-time restore (PITR)
33
description: Restore a SQL database in a managed instance to a previous point in time.
44
services: sql-database
55
ms.service: sql-database
@@ -18,22 +18,18 @@ Use point-in-time restore (PITR) to create a database as a copy of another datab
1818

1919
Point-in-time restore is useful in recovery scenarios, such as incidents caused by errors, incorrectly loaded data, or deletion of crucial data. You can also use it simply for testing or auditing. Backup files are kept for 7 to 35 days, depending on your database settings.
2020

21-
Point-in-time restore can:
21+
Point-in-time restore can restore a database:
2222

23-
- Restore a database from an existing database.
24-
- Restore a database from a deleted database.
25-
26-
For a managed instance, point-in-time restore can also:
27-
28-
- Restore a database to the same managed instance.
29-
- Restore a database to another managed instance.
30-
31-
> [!NOTE]
32-
> Point-in-time restore of a whole managed instance is not possible. This article explains only what's possible: point-in-time restore of a database that's hosted on a managed instance.
23+
- from an existing database.
24+
- from a deleted database.
25+
- to the same managed instance, or to another managed instance.
3326

3427
## Limitations
3528

36-
When you're restoring from one managed instance to another, both instances must be in the same subscription and region. Cross-region and cross-subscription restore aren't currently supported.
29+
Point in time restore to a managed instance has the following limitations:
30+
31+
- When you're restoring from one managed instance to another, both instances must be in the same subscription and region. Cross-region and cross-subscription restore aren't currently supported.
32+
- Point-in-time restore of a whole managed instance is not possible. This article explains only what's possible: point-in-time restore of a database that's hosted on a managed instance.
3733

3834
> [!WARNING]
3935
> Be aware of the storage size of your managed instance. Depending on size of the data to be restored, you might run out of instance storage. If there isn't enough space for the restored data, use a different approach.
@@ -42,13 +38,13 @@ The following table shows point-in-time restore scenarios for managed instances:
4238

4339
| |Restore existing DB to same managed instance| Restore existing DB to another managed instance|Restore dropped DB to same managed instance|Restore dropped DB to another managed instance|
4440
|:----------|:----------|:----------|:----------|:----------|
45-
|**Azure portal**| Yes|No |No|No|
41+
|**Azure portal**| Yes|No |Yes|No|
4642
|**Azure CLI**|Yes |Yes |No|No|
4743
|**PowerShell**| Yes|Yes |Yes|Yes|
4844

4945
## Restore an existing database
5046

51-
Restore an existing database to the same instance by using the Azure portal, Powershell, or the Azure CLI. To restore a database to another instance, use Powershell or the Azure CLI so you can specify the properties for the target managed instance and resource group. If you don't specify these parameters, the database will be restored to the existing instance by default. The Azure portal doesn't currently support restoring to another instance.
47+
Restore an existing database to the same instance by using the Azure portal, PowerShell, or the Azure CLI. To restore a database to another instance, use PowerShell or the Azure CLI so you can specify the properties for the target managed instance and resource group. If you don't specify these parameters, the database will be restored to the existing instance by default. The Azure portal doesn't currently support restoring to another instance.
5248

5349
# [Portal](#tab/azure-portal)
5450

@@ -86,7 +82,7 @@ Restore-AzSqlInstanceDatabase -FromPointInTimeBackup `
8682
-TargetInstanceDatabaseName $targetDatabase `
8783
```
8884

89-
To restore the database to another managed instance, also specify the names of the target resource group and managed instance:
85+
To restore the database to another managed instance, also specify the names of the target resource group and target managed instance:
9086

9187
```powershell-interactive
9288
$targetResourceGroupName = "<Resource group of target managed instance>"
@@ -130,9 +126,18 @@ For a detailed explanation of the available parameters, see the [CLI documentati
130126

131127
## Restore a deleted database
132128

133-
Restoring a deleted database can be done by using PowerShell or Azure Portal.Please use this document to do this by [Azure Portal](https://docs.microsoft.com/azure/sql-database/sql-database-recovery-using-backups#managed-instance-database-1). The database can be restored to the same instance or another instance.
129+
Restoring a deleted database can be done by using PowerShell or Azure portal. To restore a deleted database to the same instance, use either the Azure portal or PowerShell. To restore a deleted database to another instance, use PowerShell.
130+
131+
### Portal
132+
133+
134+
To recover a managed database using the Azure portal, open the managed instance overview page, and select **Deleted databases**. Choose a deleted database that you want to restore, and type the name for the new database that will be created with data restored from the backup.
134135

135-
To restore a deleted database by using PowerShell, specify your values for the parameters in the following command. Then, run the command:
136+
![Screenshot of restore deleted Azure SQL instance database](./media/sql-database-recovery-using-backups/restore-deleted-sql-managed-instance-annotated.png)
137+
138+
### PowerShell
139+
140+
To restore a database to the same instance, update the parameter values and then run the following PowerShell command:
136141

137142
```powershell-interactive
138143
$subscriptionId = "<Subscription ID>"
@@ -142,30 +147,33 @@ Select-AzSubscription -SubscriptionId $subscriptionId
142147
$resourceGroupName = "<Resource group name>"
143148
$managedInstanceName = "<Managed instance name>"
144149
$deletedDatabaseName = "<Source database name>"
150+
$targetDatabaseName = "<target database name>"
145151
146-
$deleted_db = Get-AzSqlDeletedInstanceDatabaseBackup -ResourceGroupName $resourceGroupName `
147-
-InstanceName $managedInstanceName -DatabaseName $deletedDatabaseName
152+
$deletedDatabase = Get-AzSqlDeletedInstanceDatabaseBackup -ResourceGroupName $resourceGroupName `
153+
-InstanceName $managedInstanceName -DatabaseName $deletedDatabaseName
148154
149-
$pointInTime = "2018-06-27T08:51:39.3882806Z"
150-
$properties = New-Object System.Object
151-
$properties | Add-Member -type NoteProperty -name CreateMode -Value "PointInTimeRestore"
152-
$properties | Add-Member -type NoteProperty -name RestorePointInTime -Value $pointInTime
153-
$properties | Add-Member -type NoteProperty -name RestorableDroppedDatabaseId -Value $deleted_db.Id
155+
Restore-AzSqlinstanceDatabase -Name $deletedDatabase.Name `
156+
-InstanceName $deletedDatabase.ManagedInstanceName `
157+
-ResourceGroupName $deletedDatabase.ResourceGroupName `
158+
-DeletionDate $deletedDatabase.DeletionDate `
159+
-PointInTime UTCDateTime `
160+
-TargetInstanceDatabaseName $targetDatabaseName
154161
```
155162

156-
To restore the deleted database to another instance, change the names of the resource group and managed instance. Also, make sure that the location parameter matches the location of the resource group and the managed instance.
163+
To restore the database to another managed instance, also specify the names of the target resource group and target managed instance:
157164

158165
```powershell-interactive
159-
$resourceGroupName = "<Second resource group name>"
160-
$managedInstanceName = "<Second managed instance name>"
161-
162-
$location = "West Europe"
163-
164-
$restoredDBName = "WorldWideImportersPITR"
165-
$resource_id = "subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Sql/managedInstances/$managedInstanceName/databases/$restoredDBName"
166+
$targetResourceGroupName = "<Resource group of target managed instance>"
167+
$targetInstanceName = "<Target managed instance name>"
166168
167-
New-AzResource -Location $location -Properties $properties `
168-
-ResourceId $resource_id -ApiVersion "2017-03-01-preview" -Force
169+
Restore-AzSqlinstanceDatabase -Name $deletedDatabase.Name `
170+
-InstanceName $deletedDatabase.ManagedInstanceName `
171+
-ResourceGroupName $deletedDatabase.ResourceGroupName `
172+
-DeletionDate $deletedDatabase.DeletionDate `
173+
-PointInTime UTCDateTime `
174+
-TargetInstanceDatabaseName $targetDatabaseName `
175+
-TargetResourceGroupName $targetResourceGroupName `
176+
-TargetInstanceName $targetInstanceName
169177
```
170178

171179
## Overwrite an existing database

articles/sql-database/sql-database-recovery-using-backups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ For a sample PowerShell script showing how to restore a deleted Azure SQL databa
120120

121121
#### Managed instance database
122122

123-
For a sample PowerShell script showing how to restore a deleted instance database, see [Restore deleted database on managed instance using PowerShell](https://blogs.msdn.microsoft.com/sqlserverstorageengine/20../../recreate-dropped-database-on-azure-sql-managed-instance).
123+
For a sample PowerShell script showing how to restore a deleted instance database, see [Restore deleted database on managed instance using PowerShell](sql-database-managed-instance-point-in-time-restore.md#restore-a-deleted-database)
124124

125125
> [!TIP]
126126
> To programmatically restore a deleted database, see [Programmatically performing recovery using automated backups](sql-database-recovery-using-backups.md).

0 commit comments

Comments
 (0)