Skip to content

Commit e3340da

Browse files
20240729 improve script steps and instructions in comments
1 parent 9bc0eb9 commit e3340da

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

articles/synapse-analytics/backuprestore/restore-sql-pool-from-deleted-workspace.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,52 @@ The following sample script accomplishes these steps:
3434
- This step assumes that the workspace with the same name resource group and same values is still available.
3535
- If not, recreate the dropped workspace with the same workspace name, resource group name, region, and all the same values from prior dropped workspace.
3636

37-
1. Construct the resource ID of the sql pool you wish to recover. The format requires `Microsoft.Sql`. This includes the date and time when the server was dropped.
37+
1. Construct a string the resource ID of the sql pool you wish to recover. The format requires `Microsoft.Sql`. This includes the date and time when the server was dropped.
3838

3939
1. Restore the database from the dropped workspace. Restore to the target workspace with the source SQL pool.
4040

4141
1. Verify the status of the recovered database as 'online'.
4242

4343
```powershell
44-
$SubscriptionID="<YourSubscriptionID>"
45-
$ResourceGroupName="<YourResourceGroupName>"
46-
$WorkspaceName="<YourWorkspaceNameWithoutURLSuffixSeeNote>" # Without sql.azuresynapse.net
47-
$DatabaseName="<YourDatabaseName>"
48-
$TargetResourceGroupName="<YourTargetResourceGroupName>"
49-
$TargetWorkspaceName="<YourtargetServerNameWithoutURLSuffixSeeNote>"
50-
$TargetDatabaseName="<YourDatabaseName>"
44+
$SubscriptionID = "<YourSubscriptionID>"
45+
$ResourceGroupName = "<YourResourceGroupName>"
46+
$WorkspaceName = "<YourWorkspaceNameWithoutURLSuffixSeeNote>" # Without sql.azuresynapse.net
47+
$DatabaseName = "<YourDatabaseName>"
48+
$TargetResourceGroupName = "<YourTargetResourceGroupName>"
49+
$TargetWorkspaceName = "<YourtargetServerNameWithoutURLSuffixSeeNote>"
50+
$TargetDatabaseName = "<YourDatabaseName>"
5151
5252
Connect-AzAccount
5353
Set-AzContext -SubscriptionID $SubscriptionID
5454
55-
# Get the exact date and time the workspace SQL pool was dropped.
55+
# Get the exact date and time the workspace SQL pool was dropped.
5656
# This assumes that the workspace with the same name resource group and same values is still available.
57-
# If not, recreate the dropped workspace with the same workspace name, resource group name, region, and all the same values from prior dropped workspace.
57+
# If not, recreate the dropped workspace with the same workspace name, resource group name, region,
58+
# and all the same values from prior dropped workspace.
5859
# There should only be one selection to select from.
59-
$DroppedDateTime = Get-AzSynapseDroppedSqlPool -ResourceGroupName $ResourceGroupName -WorkspaceName $WorkspaceName -Name $DatabaseName | Select-Object -ExpandProperty DeletionDate
60-
61-
# Construct the resource ID of the sql pool you wish to recover. The format requires Microsoft.Sql. This includes the approximate date time the server was dropped.
62-
$SourceDatabaseID = "/subscriptions/"+$SubscriptionID+"/resourceGroups/"+$ResourceGroupName+"/providers/Microsoft.Sql/servers/"+$WorkspaceName+"/databases/"+$DatabaseName
60+
$paramsGetDroppedSqlPool = @{
61+
ResourceGroupName = $ResourceGroupName
62+
WorkspaceName = $WorkspaceName
63+
Name = $DatabaseName
64+
}
65+
$DroppedDateTime = Get-AzSynapseDroppedSqlPool @paramsGetDroppedSqlPool `
66+
| Select-Object -ExpandProperty DeletionDate
6367
68+
# Construct a string of the resource ID of the sql pool you wish to recover.
69+
# The format requires Microsoft.Sql. This includes the approximate date time the server was dropped.
70+
$SourceDatabaseID = "/subscriptions/$SubscriptionID/resourceGroups/$ResourceGroupName/providers/" `
71+
+ "Microsoft.Sql/servers/$WorkspaceName/databases/$DatabaseName"
72+
6473
# Restore to the target workspace with the source SQL pool.
65-
$RestoredDatabase = Restore-AzSynapseSqlPool -FromDroppedSqlPool -DeletionDate $DroppedDateTime -TargetSqlPoolName $TargetDatabaseName -ResourceGroupName $TargetResourceGroupName -WorkspaceName $TargetWorkspaceName -ResourceId $SourceDatabaseID
74+
$paramsRestoreSqlPool = @{
75+
FromDroppedSqlPool = $true
76+
DeletionDate = $DroppedDateTime
77+
TargetSqlPoolName = $TargetDatabaseName
78+
ResourceGroupName = $TargetResourceGroupName
79+
WorkspaceName = $TargetWorkspaceName
80+
ResourceId = $SourceDatabaseID
81+
}
82+
$RestoredDatabase = Restore-AzSynapseSqlPool @paramsRestoreSqlPool
6683
6784
# Verify the status of restored database
6885
$RestoredDatabase.status

0 commit comments

Comments
 (0)