|
| 1 | +--- |
| 2 | +title: Restore an Azure SQL Data Warehouse | Microsoft Docs |
| 3 | +description: How to guide for restoring an Azure SQL Data Warehouse. |
| 4 | +services: sql-data-warehouse |
| 5 | +author: kevinvngo |
| 6 | +manager: craigg-msft |
| 7 | +ms.service: sql-data-warehouse |
| 8 | +ms.topic: conceptual |
| 9 | +ms.component: manage |
| 10 | +ms.date: 08/29/2018 |
| 11 | +ms.author: kevin |
| 12 | +ms.reviewer: igorstan |
| 13 | +--- |
| 14 | + |
| 15 | + |
| 16 | +# Restoring Azure SQL Data Warehouse |
| 17 | +In this article you will learn how to do the following: |
| 18 | + |
| 19 | +- Create a restore point |
| 20 | +- Restore from an automatic restore point or user-defined restore point |
| 21 | +- Restore from a deleted database |
| 22 | +- Restore from a geo-backup |
| 23 | +- Create a copy of your data warehouse from a user-defined restore point |
| 24 | + |
| 25 | +## Before you begin |
| 26 | +**Verify your DTU capacity.** Each SQL Data Warehouse is hosted by a SQL server (e.g. myserver.database.windows.net) which has a default DTU quota. Before you can restore a SQL data warehouse, verify that the your SQL server has enough remaining DTU quota for the database being restored. To learn how to calculate DTU needed or to request more DTU, see [Request a DTU quota change][Request a DTU quota change]. |
| 27 | + |
| 28 | +# Restore through PowerShell |
| 29 | + |
| 30 | +## Install PowerShell |
| 31 | +In order to use Azure PowerShell with SQL Data Warehouse, you will need to install Azure PowerShell version 1.0 or greater. You can check your version by running **Get-Module -ListAvailable -Name AzureRM**. The latest version can be installed from [Microsoft Web Platform Installer][Microsoft Web Platform Installer]. For more information on installing the latest version, see [How to install and configure Azure PowerShell][How to install and configure Azure PowerShell]. |
| 32 | + |
| 33 | +## Restore an active or paused database |
| 34 | +To restore a database from a restore point use the [Restore-AzureRmSqlDatabase][Restore-AzureRmSqlDatabase] PowerShell cmdlet. |
| 35 | + |
| 36 | +1. Open Windows PowerShell. |
| 37 | + |
| 38 | +2. Connect to your Azure account and list all the subscriptions associated with your account. |
| 39 | + |
| 40 | +3. Select the subscription that contains the database to be restored. |
| 41 | + |
| 42 | +4. List the restore points for the database. |
| 43 | + |
| 44 | +5. Pick the desired restore point using the RestorePointCreationDate. |
| 45 | + |
| 46 | + > [!NOTE] |
| 47 | + > When restoring, you can specify a different ServiceObjectiveName (DWU) or a different server residing in a different region. |
| 48 | +
|
| 49 | +6. Restore the database to the desired restore point. |
| 50 | + |
| 51 | +7. Verify that the restored database is online. |
| 52 | + |
| 53 | +```Powershell |
| 54 | +
|
| 55 | +$SubscriptionName="<YourSubscriptionName>" |
| 56 | +$ResourceGroupName="<YourResourceGroupName>" |
| 57 | +$ServerName="<YourServerNameWithoutURLSuffixSeeNote>" # Without database.windows.net |
| 58 | +$DatabaseName="<YourDatabaseName>" |
| 59 | +$NewDatabaseName="<YourDatabaseName>" |
| 60 | +
|
| 61 | +Connect-AzureRmAccount |
| 62 | +Get-AzureRmSubscription |
| 63 | +Select-AzureRmSubscription -SubscriptionName $SubscriptionName |
| 64 | +
|
| 65 | +# List the last 10 database restore points |
| 66 | +((Get-AzureRMSqlDatabaseRestorePoints -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName ($DatabaseName)).RestorePointCreationDate)[-10 .. -1] |
| 67 | +
|
| 68 | +# Or list all restore points |
| 69 | +Get-AzureRmSqlDatabaseRestorePoints -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName |
| 70 | +
|
| 71 | +# Get the specific database to restore |
| 72 | +$Database = Get-AzureRmSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName |
| 73 | +
|
| 74 | +# Pick desired restore point using RestorePointCreationDate |
| 75 | +$PointInTime="<RestorePointCreationDate>" |
| 76 | +
|
| 77 | +# Restore database from a restore point |
| 78 | +$RestoredDatabase = Restore-AzureRmSqlDatabase –FromPointInTimeBackup –PointInTime $PointInTime -ResourceGroupName $Database.ResourceGroupName -ServerName $Database.ServerName -TargetDatabaseName $NewDatabaseName –ResourceId $Database.ResourceID |
| 79 | +
|
| 80 | +# Verify the status of restored database |
| 81 | +$RestoredDatabase.status |
| 82 | +
|
| 83 | +``` |
| 84 | + |
| 85 | +> [!NOTE] |
| 86 | +> After the restore has completed, you can configure your recovered database by following [Configure your database after recovery][Configure your database after recovery]. |
| 87 | +> |
| 88 | +
|
| 89 | +## Copy your data warehouse with user-defined restore points |
| 90 | +To restore a database from a user-defined restore point use the [Restore-AzureRmSqlDatabase][Restore-AzureRmSqlDatabase] PowerShell cmdlet. |
| 91 | + |
| 92 | +1. Open Windows PowerShell. |
| 93 | +2. Connect to your Azure account and list all the subscriptions associated with your account. |
| 94 | +3. Select the subscription that contains the database to be restored. |
| 95 | +4. Create a restore point for an immediate copy of your database |
| 96 | +5. Rename your database to a temporary name. |
| 97 | +5. Retrieve the most recent restore point by the specified RestorePointLabel. |
| 98 | +6. Get the resource id of the database to initiate the restore |
| 99 | +6. Restore the database to the desired restore point. |
| 100 | +7. Verify that the restored database is online. |
| 101 | + |
| 102 | +```Powershell |
| 103 | +
|
| 104 | +$SubscriptionName="<YourSubscriptionName>" |
| 105 | +$ResourceGroupName="<YourResourceGroupName>" |
| 106 | +$ServerName="<YourServerNameWithoutURLSuffixSeeNote>" # Without database.windows.net |
| 107 | +$DatabaseName="<YourDatabaseName>" |
| 108 | +$TempDatabaseName = "<YourTemporaryDatabaseName>" |
| 109 | +$Label = "<YourRestorePointLabel" |
| 110 | +
|
| 111 | +Connect-AzureRmAccount |
| 112 | +Get-AzureRmSubscription |
| 113 | +Select-AzureRmSubscription -SubscriptionName $SubscriptionName |
| 114 | +
|
| 115 | +# Create a restore point of the original database |
| 116 | +New-AzureRmSqlDatabaseRestorePoint -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -RestorePointLabel $Label |
| 117 | +
|
| 118 | +# Rename the database to a temporary name |
| 119 | +Set-AzureRmSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -NewName $TempDatabaseName |
| 120 | +
|
| 121 | +# Get the most recent restore point with the specified label |
| 122 | +$LabelledRestorePoint = Get-AzureRmSqlDatabaseRestorePoints -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $TempDatabaseName | where {$_.RestorePointLabel -eq $Label} | sort {$_.RestorePointCreationDate} | select -Last 1 |
| 123 | +
|
| 124 | +# Get the resource id of the database |
| 125 | +$ResourceId = (Get-AzureRmSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $TempDatabaseName).ResourceId |
| 126 | +
|
| 127 | +# Restore the database to its original name from the labelled restore point from the temporary database |
| 128 | +$RestoredDatabase = Restore-AzureRmSqlDatabase -FromPointInTimeBackup -ResourceGroupName $ResourceGroupName -ServerName $ServerName -ResourceId $ResourceId -PointInTime $LabelledRestorePoint.RestorePointCreationDate -TargetDatabaseName $DatabaseName |
| 129 | +
|
| 130 | +# Verify the status of restored database |
| 131 | +$RestoredDatabase.status |
| 132 | +
|
| 133 | +# The original temporary database can be deleted at this point |
| 134 | +
|
| 135 | +``` |
| 136 | + |
| 137 | +## Restore a deleted database |
| 138 | +To restore a deleted database, use the [Restore-AzureRmSqlDatabase][Restore-AzureRmSqlDatabase] cmdlet. |
| 139 | + |
| 140 | +1. Open Windows PowerShell. |
| 141 | +2. Connect to your Azure account and list all the subscriptions associated with your account. |
| 142 | +3. Select the subscription that contains the deleted database to be restored. |
| 143 | +4. Get the specific deleted database. |
| 144 | +5. Restore the deleted database. |
| 145 | +6. Verify that the restored database is online. |
| 146 | + |
| 147 | +```Powershell |
| 148 | +$SubscriptionName="<YourSubscriptionName>" |
| 149 | +$ResourceGroupName="<YourResourceGroupName>" |
| 150 | +$ServerName="<YourServerNameWithoutURLSuffixSeeNote>" # Without database.windows.net |
| 151 | +$DatabaseName="<YourDatabaseName>" |
| 152 | +$NewDatabaseName="<YourDatabaseName>" |
| 153 | +
|
| 154 | +Connect-AzureRmAccount |
| 155 | +Get-AzureRmSubscription |
| 156 | +Select-AzureRmSubscription -SubscriptionName $SubscriptionName |
| 157 | +
|
| 158 | +# Get the deleted database to restore |
| 159 | +$DeletedDatabase = Get-AzureRmSqlDeletedDatabaseBackup -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName |
| 160 | +
|
| 161 | +# Restore deleted database |
| 162 | +$RestoredDatabase = Restore-AzureRmSqlDatabase –FromDeletedDatabaseBackup –DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $DeletedDatabase.ResourceGroupName -ServerName $DeletedDatabase.ServerName -TargetDatabaseName $NewDatabaseName –ResourceId $DeletedDatabase.ResourceID |
| 163 | +
|
| 164 | +# Verify the status of restored database |
| 165 | +$RestoredDatabase.status |
| 166 | +``` |
| 167 | + |
| 168 | +> [!NOTE] |
| 169 | +> After the restore has completed, you can configure your recovered database by following [Configure your database after recovery][Configure your database after recovery]. |
| 170 | +> |
| 171 | +
|
| 172 | +## Restore from an Azure geographical region |
| 173 | +To recover a database, use the [Restore-AzureRmSqlDatabase][Restore-AzureRmSqlDatabase] cmdlet. |
| 174 | + |
| 175 | +> [!NOTE] |
| 176 | +> You can perform a geo-restore to Gen2! To do so, specify an Gen2 ServiceObjectiveName (e.g. DW1000**c**) as an optional parameter. |
| 177 | +> |
| 178 | +
|
| 179 | +1. Open Windows PowerShell. |
| 180 | +2. Connect to your Azure account and list all the subscriptions associated with your account. |
| 181 | +3. Select the subscription that contains the database to be restored. |
| 182 | +4. Get the database you want to recover. |
| 183 | +5. Create the recovery request for the database. |
| 184 | +6. Verify the status of the geo-restored database. |
| 185 | + |
| 186 | +```Powershell |
| 187 | +Connect-AzureRmAccount |
| 188 | +Get-AzureRmSubscription |
| 189 | +Select-AzureRmSubscription -SubscriptionName "<Subscription_name>" |
| 190 | +
|
| 191 | +# Get the database you want to recover |
| 192 | +$GeoBackup = Get-AzureRmSqlDatabaseGeoBackup -ResourceGroupName "<YourResourceGroupName>" -ServerName "<YourServerName>" -DatabaseName "<YourDatabaseName>" |
| 193 | +
|
| 194 | +# Recover database |
| 195 | +$GeoRestoredDatabase = Restore-AzureRmSqlDatabase –FromGeoBackup -ResourceGroupName "<YourResourceGroupName>" -ServerName "<YourTargetServer>" -TargetDatabaseName "<NewDatabaseName>" –ResourceId $GeoBackup.ResourceID -ServiceObjectiveName "<YourTargetServiceLevel>" |
| 196 | +
|
| 197 | +# Verify that the geo-restored database is online |
| 198 | +$GeoRestoredDatabase.status |
| 199 | +``` |
| 200 | + |
| 201 | +> [!NOTE] |
| 202 | +> To configure your database after the restore has completed, see [Configure your database after recovery][Configure your database after recovery]. |
| 203 | +> |
| 204 | +
|
| 205 | +The recovered database will be TDE-enabled if the source database is TDE-enabled. |
| 206 | + |
| 207 | +# Restore through the Azure Portal |
| 208 | + |
| 209 | +## Create a user-defined restore point |
| 210 | +1. Sign in to the [Azure portal][Azure portal]. |
| 211 | + |
| 212 | +2. Navigate to the SQL data warehouse that you want to create a restore point for. |
| 213 | + |
| 214 | +3. At the top of the Overview blade, select **+New Restore Point**. |
| 215 | + |
| 216 | +  |
| 217 | + |
| 218 | +4. Specify a name for your restore point. |
| 219 | + |
| 220 | +  |
| 221 | + |
| 222 | +## Restore an active or paused database |
| 223 | +1. Sign in to the [Azure portal][Azure portal]. |
| 224 | +2. Navigate to the SQL data warehouse that you want to restore from. |
| 225 | +3. At the top of the Overview blade, select **Restore**. |
| 226 | + |
| 227 | +  |
| 228 | + |
| 229 | +4. Select either **Automatic Restore Points** or **User-Defined Restore Points**. |
| 230 | + |
| 231 | +  |
| 232 | + |
| 233 | +5. For User-Defined Restore Points, **select a Restore point** or **Create a new user-defined restore point**. |
| 234 | + |
| 235 | +  |
| 236 | + |
| 237 | +## Restore a deleted database |
| 238 | +1. Sign in to the [Azure portal][Azure portal]. |
| 239 | +2. Navigate to the SQL server your deleted database was hosted on. |
| 240 | +3. Select the Deleted databases icon in the table of contents. |
| 241 | + |
| 242 | +  |
| 243 | + |
| 244 | +4. Select the deleted database that you want to restore. |
| 245 | + |
| 246 | +  |
| 247 | + |
| 248 | +5. Specify a new database name. |
| 249 | + |
| 250 | +  |
| 251 | + |
| 252 | +<!--Image references--> |
| 253 | + |
| 254 | +<!--Article references--> |
| 255 | +[Azure SQL Database business continuity overview]: ../sql-database/sql-database-business-continuity.md |
| 256 | +[Request a DTU quota change]: ./sql-data-warehouse-get-started-create-support-ticket.md |
| 257 | +[Configure your database after recovery]: ../sql-database/sql-database-disaster-recovery.md#configure-your-database-after-recovery |
| 258 | +[How to install and configure Azure PowerShell]: /powershell/azureps-cmdlets-docs |
| 259 | +[Overview]: ./sql-data-warehouse-restore-database-overview.md |
| 260 | +[Portal]: ./sql-data-warehouse-restore-database-portal.md |
| 261 | +[PowerShell]: ./sql-data-warehouse-restore-database-powershell.md |
| 262 | +[REST]: ./sql-data-warehouse-restore-database-rest-api.md |
| 263 | +[Configure your database after recovery]: ../sql-database/sql-database-disaster-recovery.md#configure-your-database-after-recovery |
| 264 | + |
| 265 | +<!--MSDN references--> |
| 266 | +[Restore-AzureRmSqlDatabase]: https://docs.microsoft.com/powershell/module/azurerm.sql/restore-azurermsqldatabase |
| 267 | + |
| 268 | +<!--Other Web references--> |
| 269 | +[Azure Portal]: https://portal.azure.com/ |
| 270 | +[Microsoft Web Platform Installer]: https://aka.ms/webpi-azps |
0 commit comments